# Ruby web scraping libraries

Ruby web scraping libraries fetch web pages and extract structured data from their HTML. Pages that build their content with JavaScript need a controlled browser to render them before extraction. These libraries let data pipelines and AI agents collect prices, listings, and articles from sites without an API.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Nokogiri](#nokogiri) | 1304424215 | 6.3K | Nov 2026 | MIT |
| [Watir](#watir) | 43086188 | 1.5K | Aug 2023 | MIT |
| [Mechanize](#mechanize) | 42799551 | 4.4K | Oct 2026 | MIT |
| [Oga](#oga) | 29980372 | Not on GitHub | Jun 2026 | MPL-2.0 |
| [Ferrum](#ferrum) | 18077697 | 2.1K | Nov 2026 | MIT |
| [playwright-ruby-client](#playwright-ruby-client) | 5381415 | Not on GitHub | Nov 2026 | MIT |
| [Anemone](#anemone) | 1358349 | Not on GitHub | May 2012 | MIT |
| [Kimurai](#kimurai) | 260985 | Not on GitHub | Jan 2026 | MIT |

Downloads: RubyGems, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Nokogiri](#nokogiri) has the most monthly downloads in this comparison, at 1304424215, a count that covers all its HTML and XML parsing.

## Capabilities

| Library | URL retrieval | JavaScript execution | Crawl scheduling |
| --- | --- | --- | --- |
| [Nokogiri](#nokogiri) | No | No | No |
| [Watir](#watir) | Yes | Yes | No |
| [Mechanize](#mechanize) | Yes | No | No |
| [Oga](#oga) | No | No | No |
| [Ferrum](#ferrum) | Yes | Yes | No |
| [playwright-ruby-client](#playwright-ruby-client) | Yes | Yes | No |
| [Anemone](#anemone) | Yes | No | Yes |
| [Kimurai](#kimurai) | Yes | Yes | Yes |

## Libraries

### Nokogiri

[GitHub](https://github.com/sparklemotion/nokogiri) · [RubyGems](https://rubygems.org/gems/nokogiri) · [Docs](https://api.github.com/repos/sparklemotion/nokogiri/readme)

Parses and queries HTML and XML documents from Ruby.

- Downloads / mo: 1304424215
- Stars: 6.3K
- Last release: 1.19.7
- License: MIT
- Capabilities: [From the Nokogiri docs](https://api.github.com/repos/sparklemotion/nokogiri/readme)

**Strengths**

- **Queries with CSS and XPath.** Extract nodes using familiar CSS selectors or XPath paths.
- **Edits parsed document nodes.** Change node content, attributes, and positions before serializing the document.

**Watch out for**

- **Encoding guesses can be wrong.** Set the encoding explicitly when the source declaration is incorrect.
- **Runtime parsers can behave differently.** Check important extraction results when moving between CRuby and JRuby.

```sh
gem install nokogiri -v 1.19.7
```

**huginn/huginn** (50.6K stars)

[huginn/huginn](https://github.com/huginn/huginn) 

```ruby
def parse(data)
      case type = extraction_type
      when "xml"
        doc = Nokogiri::XML(data)
        # ignore xmlns, useful when parsing atom feeds
        doc.remove_namespaces! unless use_namespaces?
        doc
      when "json"
        JSON.parse(data)
      when "html"
        Nokogiri::HTML(data)
      when "text"
        data
      else
        raise "Unknown extraction type: #{type}"
      end
    end
```

[app/models/agents/website_agent.rb](https://github.com/huginn/huginn/blob/639c050b2bf4e14ef9983012af99dfc1dc68b334/app/models/agents/website_agent.rb#L708-L724) · [More projects using Nokogiri →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20nokogiri%20to%20extract%20HTML%20CSS%20XPath%20fields%2C%20preserve%20website%20sessions%2C%20configure%20proxy%20pages%20and%20read%20browser%20content&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require "nokogiri"

puts Nokogiri::HTML("<h1>Hello</h1>").at_css("h1").text

```

From [README.md](https://api.github.com/repos/sparklemotion/nokogiri/readme)

### Watir

[GitHub](https://github.com/watir/watir) · [RubyGems](https://rubygems.org/gems/watir) · [Docs](https://api.github.com/repos/watir/watir/readme)

Automates browser clicks, form input, and text checks from Ruby.

- Downloads / mo: 43086188
- Stars: 1.5K
- Last release: 7.3.0
- License: MIT
- Capabilities: [From the Watir docs](https://api.github.com/repos/watir/watir/readme)

**Strengths**

- **Waits before acting on elements.** Element actions wait for the element to become ready.
- **Offers readable attribute selectors.** Find elements by labels, text, and other meaningful attributes.

**Watch out for**

- **CSS selectors must stand alone.** Use CSS or XPath without adding other locator keys.
- **Reads need their own waits.** Use wait_until before reading content that arrives asynchronously.

```sh
gem install watir -v 7.3.0
```

**cheezy/page-object** (648 stars)

[cheezy/page-object](https://github.com/cheezy/page-object) 

```ruby
def element_with_focus
          element = browser.execute_script("return document.activeElement")
          type = element.type.to_sym if element.tag_name.to_sym == :input
          cls = ::PageObject::Elements.element_class_for(element.tag_name, type)
          cls.new(element)
        end
```

[lib/page-object/platforms/watir/page_object.rb](https://github.com/cheezy/page-object/blob/17275a2d5e2384ab2e8c84082f97861b558ac0c9/lib/page-object/platforms/watir/page_object.rb#L135-L140) · [More projects using Watir →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20watir%20to%20extract%20HTML%20CSS%20XPath%20fields%2C%20preserve%20website%20sessions%2C%20configure%20proxy%20pages%20and%20read%20browser%20content&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require "watir"

browser = Watir::Browser.start("https://example.com/")
puts browser.title
browser.close

```

From [browser.rb](https://api.github.com/repos/watir/watir/contents/lib/watir/browser.rb?ref=v7.3.0)

### Mechanize

[GitHub](https://github.com/sparklemotion/mechanize) · [RubyGems](https://rubygems.org/gems/mechanize) · [Docs](https://api.github.com/repos/sparklemotion/mechanize/readme)

Automates website navigation with cookies, redirects, and form submission.

- Downloads / mo: 42799551
- Stars: 4.4K
- Last release: 2.14.2
- License: MIT
- Capabilities: [From the Mechanize docs](https://api.github.com/repos/sparklemotion/mechanize/readme)

**Strengths**

- **Preserves cookies across navigation.** Follow links and redirects while retaining the website session.
- **Fills and submits HTML forms.** Populate form fields before submitting through the session.

**Watch out for**

- **JavaScript pages need another tool.** Use a browser when required content is generated by JavaScript.

```sh
gem install mechanize -v 2.14.2
```

**rubycdp/vessel** (725 stars)

[rubycdp/vessel](https://github.com/rubycdp/vessel) 

```ruby
def create_page(proxy: nil)
          mechanize = ::Mechanize.new do |m|
            m.user_agent = settings.dig(:headers, "User-Agent")
            m.set_proxy(proxy[:host], proxy[:port], proxy[:user], proxy[:password]) if proxy
          end

          Page.new(mechanize)
        end
```

[lib/vessel/driver/mechanize/driver.rb](https://github.com/rubycdp/vessel/blob/f6d18898ad9329fc36a69fd409e3b06c1d480bb9/lib/vessel/driver/mechanize/driver.rb#L28-L35) · [More projects using Mechanize →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20mechanize%20to%20extract%20HTML%20CSS%20XPath%20fields%2C%20preserve%20website%20sessions%2C%20configure%20proxy%20pages%20and%20read%20browser%20content&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require "mechanize"

agent = Mechanize.new
puts agent.get("https://example.com/").title

```

From [spider.rb](https://github.com/sparklemotion/mechanize/blob/main/GUIDE.rdoc)

### Oga

[GitHub](https://github.com/yorickpeterse/oga) · [RubyGems](https://rubygems.org/gems/oga) · [Docs](https://api.github.com/repos/yorickpeterse/oga/readme)

Oga is an XML/HTML parser written in Ruby.

- Downloads / mo: 29980372
- Last release: 3.5
- License: MPL-2.0
- Capabilities: [From the Oga docs](https://api.github.com/repos/yorickpeterse/oga/readme)

```sh
gem install oga -v 3.5
```

**thibaudgg/video_info** (429 stars)

[thibaudgg/video_info](https://github.com/thibaudgg/video_info) 

```ruby
def _set_data_from_api_impl(api_url)
        # handle fullscreen video URLs
        if url.include?(".com/v/")
          video_id = url.split("/v/")[1].split("?")[0]
          new_url = "https://www.youtube.com/watch?v=" + video_id
          Oga.parse_html(URI.parse(new_url).read)
        else
          Oga.parse_html(URI.parse(api_url).read)
        end
      end
```

[lib/video_info/providers/youtube_scraper.rb](https://github.com/thibaudgg/video_info/blob/e32a826c35154dea7a99e7ebef606e2caaf33016/lib/video_info/providers/youtube_scraper.rb#L114-L123) · [More projects using Oga →](https://dashboard.exa.ai/playground/search?q=oga%20GitHub%20projects)

**Quickstart**

```ruby
require "oga"

document = Oga.parse_html("<h1>Hello</h1>")
puts document.to_xml

```

From [README.md](https://api.github.com/repos/yorickpeterse/oga/readme)

### Ferrum

[GitHub](https://github.com/rubycdp/ferrum) · [RubyGems](https://rubygems.org/gems/ferrum) · [Docs](https://api.github.com/repos/rubycdp/ferrum/readme)

Controls Chrome or Chromium directly through the DevTools Protocol.

- Downloads / mo: 18077697
- Stars: 2.1K
- Last release: 0.20.2
- License: MIT
- Capabilities: [From the Ferrum docs](https://api.github.com/repos/rubycdp/ferrum/readme)

**Strengths**

- **Controls Chrome without ChromeDriver.** Connect directly through CDP, Chrome’s browser-control protocol.
- **Reads JavaScript-rendered page content.** Evaluate JavaScript and query elements in a live browser.

**Watch out for**

- **Requires Chrome or Chromium.** Use Watir when the workflow needs another browser family.
- **Network-idle waits can fail.** Check the boolean result or use wait_for_idle! for an exception.

```sh
gem install ferrum -v 0.20.2
```

**rubycdp/vessel** (725 stars)

[rubycdp/vessel](https://github.com/rubycdp/vessel) 

```ruby
def create_page(proxy: nil)
          options = {}
          options.merge!(proxy: proxy) if proxy
          page = browser.create_page(**options)
          Page.new(page, context: browser.contexts[page.context_id])
        end
```

[lib/vessel/driver/ferrum/driver.rb](https://github.com/rubycdp/vessel/blob/f6d18898ad9329fc36a69fd409e3b06c1d480bb9/lib/vessel/driver/ferrum/driver.rb#L34-L39) · [More projects using Ferrum →](https://dashboard.exa.ai/playground/search?q=Ruby%20applications%20using%20ferrum%20to%20extract%20HTML%20CSS%20XPath%20fields%2C%20preserve%20website%20sessions%2C%20configure%20proxy%20pages%20and%20read%20browser%20content&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```ruby
require "ferrum"

browser = Ferrum::Browser.new
browser.go_to("https://example.com/")
puts browser.title
browser.quit

```

From [README.md](https://api.github.com/repos/rubycdp/ferrum/readme)

### playwright-ruby-client

[GitHub](https://github.com/YusukeIwaki/playwright-ruby-client) · [RubyGems](https://rubygems.org/gems/playwright-ruby-client) · [Docs](https://api.github.com/repos/YusukeIwaki/playwright-ruby-client/readme)

Provides the Ruby binding of the Playwright driver.

- Downloads / mo: 5381415
- Last release: 1.65.0
- License: MIT
- Capabilities: [From the playwright-ruby-client docs](https://api.github.com/repos/YusukeIwaki/playwright-ruby-client/readme)

```sh
gem install playwright-ruby-client -v 1.65.0
```

**YusukeIwaki/capybara-playwright-driver** (254 stars)

[YusukeIwaki/capybara-playwright-driver](https://github.com/YusukeIwaki/capybara-playwright-driver) 

```ruby
def playwright_browser
            browser_type = playwright_execution.playwright.send(@browser_type)
            browser_options = @browser_options.value
            browser_type.launch(**browser_options)
          end
```

[lib/capybara/playwright/browser_runner.rb](https://github.com/YusukeIwaki/capybara-playwright-driver/blob/4d8dde74aa3e164d396fffb9dcbc5e4405228db6/lib/capybara/playwright/browser_runner.rb#L75-L79) · [More projects using playwright-ruby-client →](https://dashboard.exa.ai/playground/search?q=playwright-ruby-client%20GitHub%20projects)

**Quickstart**

```ruby
require "playwright"

Playwright.create(playwright_cli_executable_path: "./node_modules/.bin/playwright-core") do |playwright|
  playwright.chromium.launch do |browser|
    page = browser.new_page
    page.goto("https://example.com/")
    puts page.title
  end
end

```

From [README.md](https://api.github.com/repos/YusukeIwaki/playwright-ruby-client/readme)

### Anemone

[GitHub](https://github.com/chriskite/anemone) · [RubyGems](https://rubygems.org/gems/anemone) · [Docs](https://api.github.com/repos/chriskite/anemone/readme)

Provides a web-spider framework.

- Downloads / mo: 1358349
- Last release: 0.7.2
- License: MIT
- Capabilities: [From the Anemone docs](https://api.github.com/repos/chriskite/anemone/readme)

```sh
gem install anemone -v 0.7.2
```

**bbc/wraith** (4.8K stars)

[bbc/wraith](https://github.com/bbc/wraith) 

```ruby
def crawl
    logger.info "Crawling #{wraith.base_domain}"
    Anemone.crawl(wraith.base_domain) do |anemone|
      anemone.skip_links_like(/\.(#{EXT.join('|')})$/)
      # Add user specified skips
      anemone.skip_links_like(wraith.spider_skips)
      anemone.on_every_page do |page|
        logger.info "    #{page.url.path}"
        add_path(page.url.path)
      end
    end

    logger.info "Crawl complete."
    write_file
  end
```

[lib/wraith/spider.rb](https://github.com/bbc/wraith/blob/93e2eee6ecfad6523684520bcc67e61ad31cceaf/lib/wraith/spider.rb#L23-L37) · [More projects using Anemone →](https://dashboard.exa.ai/playground/search?q=anemone%20GitHub%20projects)

**Quickstart**

```ruby
require "anemone"

Anemone.crawl("https://example.com/") do |crawler|
  crawler.on_every_page { |page| puts page.url }
end

```

From [core.rb](https://github.com/chriskite/anemone/blob/master/lib/anemone/core.rb)

### Kimurai

[GitHub](https://github.com/vifreefly/kimuraframework) · [RubyGems](https://rubygems.org/gems/kimurai) · [Docs](https://github.com/vifreefly/kimuraframework/blob/master/README.md)

Provides a web scraping framework in Ruby based on Capybara and Nokogiri.

- Downloads / mo: 260985
- Last release: 2.2.0
- License: MIT
- Capabilities: [From the Kimurai docs](https://github.com/vifreefly/kimuraframework/blob/master/README.md)

```sh
gem install kimurai -v 2.2.0
```

**nooverviewavailable/NoOverviewAvailable.com** (157 stars)

[nooverviewavailable/NoOverviewAvailable.com](https://github.com/nooverviewavailable/NoOverviewAvailable.com) 

```ruby
def parse(response, url:, data: {})
    Parallel.each(response.css('a.category-list-item-link')) do |framework|
      request_to :parse_framework, url: URI.join('https://developer.apple.com/', framework[:href]).to_s
    rescue StandardError => e
      puts "There is failed request (#{e.inspect}), skipping it..."
    end
  end
```

[lib/apple_developer_spider.rb](https://github.com/nooverviewavailable/NoOverviewAvailable.com/blob/4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3/lib/apple_developer_spider.rb#L21-L27) · [More projects using Kimurai →](https://dashboard.exa.ai/playground/search?q=kimurai%20GitHub%20projects)

**Quickstart**

```ruby
require "kimurai"

class ExampleSpider < Kimurai::Base
  @engine = :mechanize
  @start_urls = ["https://example.com/"]
  def parse(response, url:, data: {})
    puts url
  end
end

ExampleSpider.crawl!

```

From [README.md](https://github.com/vifreefly/kimuraframework/blob/master/README.md)

## FAQ

### Which Ruby web scraping library should I use?

[Nokogiri](#nokogiri) suits parsing fetched HTML with CSS selectors or XPath. [Mechanize](#mechanize) suits sites that need cookies, redirects, and form submission. [Ferrum](#ferrum) suits pages that JavaScript renders in Chrome.

### What is Nokogiri?

[Nokogiri](#nokogiri) parses and queries HTML and XML documents from Ruby with CSS selectors or XPath.

### What is Watir?

[Watir](#watir) automates browser clicks, form input, and text checks from Ruby. Element actions wait for each element to become ready.

### What is Ferrum?

[Ferrum](#ferrum) controls Chrome or Chromium directly through the DevTools Protocol, without ChromeDriver.

### Can Mechanize scrape JavaScript pages?

No. Content generated by JavaScript needs a browser such as [Ferrum](#ferrum) or [Watir](#watir).

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Ruby web scraping libraries Nokogiri Mechanize Ferrum Watir code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
