GithubHelp home page GithubHelp logo

robotex's People

Contributors

chase0213 avatar chriskite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

robotex's Issues

Robotex does not follow user-agent precedence rules

Bug Steps:
Attempt to extract the delay for a user agent from a robots.txt file where the crawl-delay for a specific user agent appears after the rule for *. Example:
https://www.archives.gov/robots.txt

User-agent: *
Crawl-delay: 10
...
User-agent: usasearch
Crawl-delay: 2

Expected results:

> Robotex.new('usasearch').delay('https://www.archives.gov')
#=> 2

Actual results:

> Robotex.new('usasearch').delay('https://www.archives.gov')
#=> 10

See https://developers.google.com/search/reference/robots_txt#order-of-precedence-for-user-agents for precedence rules.

Warnings about unused variable and instance variable not initialized

If Ruby is in warnings mode, two warnings are output. Here's a script to reproduce the problem. This script is straight out of the examples, except it's run in warnings mode:

#!/usr/bin/ruby -w
require 'robotex'
robotex = Robotex.new "My User Agent"
robotex.allowed?("http://www.example.com/foo")

These are the warnings given:

/var/lib/gems/2.3.0/gems/robotex-1.0.0/lib/robotex.rb:103: warning: assigned but unused variable - io
/var/lib/gems/2.3.0/gems/robotex-1.0.0/lib/robotex.rb:115: warning: instance variable @timeout not initialized

Maintenance status?

@chriskite , is this repo being maintained? Any interest in adding a maintainer or transferring maintenance to someone else?

method to extract sitemaps

It would be very useful to have a method to extract the sitemaps listed in a robots.txt file, per the sitemaps specification: https://www.sitemaps.org/protocol.html#submit_robots

Example usage:
http://www.nytimes.com/robots.txt

Sitemap: http://spiderbites.nytimes.com/sitemaps/www.nytimes.com/sitemap.xml.gz
Sitemap: http://www.nytimes.com/sitemaps/sitemap_news/sitemap.xml.gz
Sitemap: http://spiderbites.nytimes.com/sitemaps/sitemap_video/sitemap.xml.gz
Sitemap: http://spiderbites.nytimes.com/sitemaps/www.nytimes.com_realestate/sitemap.xml.gz
Sitemap: http://spiderbites.nytimes.com/sitemaps/www.nytimes.com/2016_election_sitemap.xml.gz
> robotex = Robotex.new
> robotex.sitemaps('http://www.nytimes.com')
=> ["http://spiderbites.nytimes.com/sitemaps/www.nytimes.com/sitemap.xml.gz",
 "http://www.nytimes.com/sitemaps/sitemap_news/sitemap.xml.gz",
 "http://spiderbites.nytimes.com/sitemaps/sitemap_video/sitemap.xml.gz",
 "http://spiderbites.nytimes.com/sitemaps/www.nytimes.com_realestate/sitemap.xml.gz",
 "http://spiderbites.nytimes.com/sitemaps/www.nytimes.com/2016_election_sitemap.xml.gz"]

Robotex does not follow redirects

Robotex does not follow redirected robots.txt pages, which can result in pages erroneously appearing to be allowed?. Example:

In https://www.yelp.com/robots.txt:
Disallow: /biz_link

> robotex = Robotex.new "My User Agent"

> robotex.allowed?("https://www.yelp.com/biz_link")
false #correct

> robotex = Robotex.new "My User Agent"

> robotex.allowed?("http://www.yelp.com/biz_link")
true #incorrect

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.