wombat

felipecslMIT活跃维护

轻量级 Ruby 网页爬虫与抓取库,提供优雅的 DSL,用几行声明式代码就能从页面中提取结构化数据。

Lightweight Ruby web crawler/scraper with an elegant DSL which extracts structured data from pages.

v3.4.0发布于 2026-10-27 16:38 UTC1,360star128fork同步于 2026-11-10 11:48 UTC

怎么上手

由 README 提炼,执行前请确认
gem install wombat
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

轻量 Ruby 网页爬虫,用优雅 DSL 从页面抽取结构化数据

轻量级 Ruby 网页爬虫与抓取库,提供优雅的 DSL,用几行声明式代码就能从页面中提取结构化数据。

核心能力

  • 用 Wombat.crawl 加块定义抓取任务
  • 支持 xpath 与 css 两种选择器定位元素
  • 用 :list 标记把多个匹配结果收集成数组
  • 嵌套块组织分组字段,输出嵌套哈希
  • 块内可用 gsub 等方法对抓取值做后处理

容易踩的坑

README 未说明 Ruby 版本要求,需自行确认兼容性;完整用法只在 Wiki 和 API 文档里,README 仅给示例

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本v3.4.0
  1. v3.4.0最新正式版2026-10-27 · 2026-10-27 16:38 UTC
  2. v3.3.02026-04-07 · 2026-04-07 16:32 UTC
    查看更新说明
  3. v3.2.02025-11-27 · 2025-11-27 00:58 UTC
    查看更新说明
    • Bumped all dependencies to latest
    • Updated ruby version to v3.4

    Note: v3.1.0 was skipped altogether.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Wombat

    Gem Version Code Climate Coverage Status FOSSA Status

    Web scraper with an elegant DSL that parses structured data from web pages.

    Usage:

    gem install wombat

    Scraping a page:

    The simplest way to use Wombat is by calling Wombat.crawl and passing it a block:

    require 'wombat'
    
    Wombat.crawl do
      base_url "https://www.github.com"
      path "/"
    
      headline xpath: "//h1"
      subheading css: "p.alt-lead"
    
      what_is({ css: ".one-fourth h4" }, :list)
    
      links do
        explore xpath: '/html/body/header/div/div/nav[1]/a[4]' do |e|
          e.gsub(/Explore/, "Love")
        end
    
        features css: '.nav-item-opensource'
        business css: '.nav-item-business'
      end
    end
    
    The code above is gonna return the following hash:
    {
      "headline"=>"How people build software",
      "subheading"=>"Millions of developers use GitHub to build personal projects, support their businesses, and work together on open source technologies.",
      "what_is"=>[
        "For everything you build",
        "A better way to work",
        "Millions of projects",
        "One platform, from start to finish"
      ],
      "links"=>{
        "explore"=>"Love",
        "features"=>"Open source",
        "business"=>"Business"
      }
    }
    

    This is just a sneak peek of what Wombat can do. For the complete documentation, please check the links below:

    Wiki

    API Documentation

    Changelog

    Contributing to Wombat

    • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
    • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
    • Fork the project
    • Start a feature/bugfix branch
    • Commit and push until you are happy with your contribution
    • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
    • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

    Contributors

    Copyright

    Copyright (c) 2019 Felipe Lima. See LICENSE.txt for further details.

    License

    FOSSA Status