github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

postmodern / spidr

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 26
    • 4
  • Source
  • Commits
  • Network (4)
  • Issues (2)
  • Downloads (13)
  • Wiki (2)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (13)
    • 0.2.2
    • 0.2.1
    • 0.2.0
    • 0.1.9
    • 0.1.8
    • 0.1.7
    • 0.1.6
    • 0.1.5
    • 0.1.4
    • 0.1.3
    • 0.1.2
    • 0.1.1
    • 0.1.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A versatile Ruby web spidering library that can spider a site, multiple domains, certain links or infinitely. Spidr is designed to be fast and easy to use. — Read more

  cancel

http://spidr.rubyforge.org/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Make the top-level links raw URLs. 
postmodern (author)
Sun Jan 31 23:01:46 -0800 2010
commit  6de444bf2b2576ca32c43a78d9661de6d31734b8
tree    25115568d3aa1bb6c3d5f1585ebe6ce27047585d
parent  fd3a46df31fa1a4d54e43334f32739255dfb6ae2
spidr /
name age
history
message
file .gitignore Sun Aug 23 15:12:32 -0700 2009 Added the YARD documentation generation task. [postmodern]
file History.md Sun Jan 31 22:05:09 -0800 2010 Added more markdown formatting. [postmodern]
file Manifest.txt Sun Jan 31 22:12:09 -0800 2010 Fixed the Manifest. [postmodern]
file README.md Sun Jan 31 23:01:46 -0800 2010 Make the top-level links raw URLs. [postmodern]
file Rakefile Sun Jan 31 21:58:50 -0800 2010 Switched the YARD doc formatting to markdown. [postmodern]
directory lib/ Sun Jan 31 21:58:50 -0800 2010 Switched the YARD doc formatting to markdown. [postmodern]
directory spec/ Sun Jan 10 23:02:31 -0800 2010 Removed an overly strict spec. [postmodern]
README.md

Spidr

  • http://spidr.rubyforge.org/
  • http://github.com/postmodern/spidr
  • http://github.com/postmodern/spidr/issues
  • http://groups.google.com/group/spidr
  • irc.freenode.net #spidr

DESCRIPTION:

Spidr is a versatile Ruby web spidering library that can spider a site, multiple domains, certain links or infinitely. Spidr is designed to be fast and easy to use.

FEATURES:

  • Follows:
    • a tags.
    • iframe tags.
    • frame tags.
    • Cookie protected links.
    • HTTP 300, 301, 302, 303 and 307 Redirects.
    • HTTP Basic Auth protected links.
  • Black-list or white-list URLs based upon:
    • URL scheme.
    • Host name
    • Port number
    • Full link
    • URL extension
  • Provides call-backs for:
    • Every visited Page.
    • Every visited URL.
    • Every visited URL that matches a specified pattern.
    • Every URL that failed to be visited.
  • Provides action methods to:
    • Pause spidering.
    • Skip processing of pages.
    • Skip processing of links.
  • Restore the spidering queue and history from a previous session.
  • Custom User-Agent strings.
  • Custom proxy settings.
  • HTTPS support.

EXAMPLES:

Start spidering from a URL:

Spidr.start_at('http://tenderlovemaking.com/')

Spider a host:

Spidr.host('coderrr.wordpress.com')

Spider a site:

Spidr.site('http://rubyflow.com/')

Spider multiple hosts:

Spidr.start_at(
  'http://company.com/',
  :hosts => [
    'company.com',
    /host\d\.company\.com/
  ]
)

Do not spider certain links:

Spidr.site('http://matasano.com/', :ignore_links => [/log/])

Do not spider links on certain ports:

Spidr.site(
  'http://sketchy.content.com/',
  :ignore_ports => [8000, 8010, 8080]
)

Print out visited URLs:

Spidr.site('http://rubyinside.org/') do |spider|
  spider.every_url { |url| puts url }
end

Print out the URLs that could not be requested:

Spidr.site('http://sketchy.content.com/') do |spider|
  spider.every_failed_url { |url| puts url }
end

Search HTML and XML pages:

Spidr.site('http://company.withablog.com/') do |spider|
  spider.every_page do |page|
    puts "[-] #{page.url}"

    page.search('//meta').each do |meta|
      name = (meta.attributes['name'] || meta.attributes['http-equiv'])
      value = meta.attributes['content']

      puts "    #{name} = #{value}"
    end
  end
end

Print out the titles from every page:

Spidr.site('http://www.rubypulse.com/') do |spider|
  spider.every_html_page do |page|
    puts page.title
  end
end

Find what kinds of web servers a host is using, by accessing the headers:

servers = Set[]

Spidr.host('generic.company.com') do |spider|
  spider.all_headers do |headers|
    servers << headers['server']
  end
end

Pause the spider on a forbidden page:

spider = Spidr.host('overnight.startup.com') do |spider|
  spider.every_forbidden_page do |page|
    spider.pause!
  end
end

Skip the processing of a page:

Spidr.host('sketchy.content.com') do |spider|
  spider.every_missing_page do |page|
    spider.skip_page!
  end
end

Skip the processing of links:

Spidr.host('sketchy.content.com') do |spider|
  spider.every_url do |url|
    if url.path.split('/').find { |dir| dir.to_i > 1000 }
      spider.skip_link!
    end
  end
end

REQUIREMENTS:

  • nokogiri >= 1.2.0

INSTALL:

$ sudo gem install spidr

LICENSE:

The MIT License

Copyright (c) 2008-2010 Hal Brodigan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server