Giter Site home page Giter Site logo

stewartmckee / cobweb Goto Github PK

View Code? Open in Web Editor NEW
228.0 9.0 45.0 5.46 MB

Web crawler with very flexible crawling options. Can either use standalone or can be used with resque to perform clustered crawls.

License: MIT License

Ruby 16.56% CSS 13.30% JavaScript 54.29% Shell 0.01% HTML 15.84%

cobweb's Introduction

Cobweb v1.1.0

@cobweb_gem



Coverage Status

Intro

CobWeb has three methods of running. Firstly it is a http client that allows get and head requests returning a hash of data relating to the requested resource. The second main function is to utilize this combined with the power of Resque to cluster the crawls allowing you crawl quickly. Lastly you can run the crawler with a block that uses each of the pages found in the crawl. I’ve created a sample app to help with setting up cobweb at http://github.com/stewartmckee/cobweb_sample

Resque

When running on resque, passing in a Class and queue name it will enqueue all resources to this queue for processing, passing in the hash it has generated. You then implement the perform method to process the resource for your own application.

Standalone

CobwebCrawler takes the same options as cobweb itself, so you can use any of the options available for that. An example is listed below. While the crawler is running, you can view statistics on http://localhost:4567

Command Line

Cobweb can also be ran from the command line to perform various pre-canned tasks.
  • report – output a csv with data from the crawl
  • export – creates a local replication of the data on the server based off the url structure. Text data is stored in yaml format.
Run “cobweb —help” for more info

Data Returned For Each Page
The data available in the returned hash are:

  • :url – url of the resource requested
  • :status_code – status code of the resource requested
  • :response_time – response time of the resource requested
  • :mime_type – content type of the resource
  • :character_set – character set of content determined from content type
  • :length – length of the content returned
  • :body – content of the resource
  • :location – location header if returned
  • :redirect_through – if your following redirects, any redirects are stored here detailing where you were redirected through to get to the final location
  • :headers – hash or the headers returned
  • :links – hash or links on the page split in to types
    • :links – urls from a tags within the resource
    • :images – urls from img tags within the resource
    • :related – urls from link tags
    • :scripts – urls from script tags
    • :styles – urls from within link tags with rel of stylesheet and from url() directives with stylesheets
The source for the links can be overridden, contact me for the syntax (don’t have time to put it into this documentation, will as soon as i have time!)

Statistics

Statistics are available during the crawl, you can create a Stats object passing in a hash with redis_options and crawl_id. Stats has a get_statistics method that returns a hash of the statistics available to you. It is also returned by default from the CobwebCrawler.crawl standalone crawling method. The data available within statistics is as follows:
  • :average_length – average size of each objet
  • :minimum_length – minimum length returned
  • :queued_at – date and time that the crawl was started at (eg: “2012-09-10T23:10:08+01:00”)
  • :maximum_length – maximum length of object received
  • :status_counts – hash with the status returned as the key and value as number of pages (eg: {"404" => 1, “200” => 1})
  • :mime_counts – hash containing the mime type as key and count or pages as value (eg: {"text/html" => 8, “image/jpeg” => 25)})
  • :queue_counter – size of queue waiting to be processed for crawl
  • :page_count – number of html pages retrieved
  • :total_length – total size of data received
  • :current_status – Current status of crawl
  • :asset_count – count of non-html objects received
  • :page_size – total size of pages received
  • :average_response_time – average response time of all objects
  • :crawl_counter – number of objects that have been crawled
  • :minimum_response_time – quickest response time of crawl
  • :maximum_response_time – longest response time of crawl
  • :asset_size – total size of all non-assets received

Installation

Install crawler as a gem

gem install cobweb

or in a Gemfile

gem 'cobweb'

Usage

Cobweb

new(options)

Creates a new crawler object based on a base_url

  • options – The following hash keys can be defined:
  • :follow_redirects – transparently follows redirects and populates the :redirect_through key in the content hash (Default: true)
  • :redirect_limit – sets the limit to be used for concurrent redirects (Default: 10)
  • :queue_system – sets the the queue system :resque or :sidekiq (Default: :resque)
  • :processing_queue – specifies the processing queue for content to be sent to (Default: ‘CobwebProcessJob’ when using resque, ‘CrawlProcessWorker’ when using sidekiq)
  • :crawl_finished_queue – specifies the processing queue for statistics to be sent to after finishing crawling (Default: ‘CobwebFinishedJob’ when using resque, ‘CrawlFinishedWorker’ when using sidekiq)
  • :debug – enables debug output (Default: false)
  • :quiet – hides default output (Default: false)
  • :cache – sets the ttl for caching pages, set to nil to disable caching (Default: 300)
  • :timeout – http timeout for requests (Default: 10)
  • :redis_options – hash containing the initialization options for redis (e.g. {:host => “redis.mydomain.com”}) (Default: {})
  • :internal_urls – array of strings representing internal url forms for your site (eg: [‘http://test.com/*’, ‘http://blog.test.com/*’, ‘http://externaltest.com/*’]) (Default: [], although your first url’s scheme, host and domain are added)
  • :first_page_redirect_internal – if true and the first page crawled is a redirect, it will add the final destination of redirects to the internal_urls (e.g. http://www.test.com gets redirected to http://test.com) (Default: true)
  • :crawl_id – the id used internally for identifying the crawl. Can be used by the processing job to seperate crawls
  • :internal_urls – an array of urls with * wildcards that represent urls internal to the site (ie pages within the same domain)
  • :external_urls – an array of urls with * wildcards that represent urls external to the site (overrides internal_urls)
  • :seed_urls – an array of urls that are put into the queue regardless of any other setting, combine with {:external_urls => "*"} to limit to seed urls
  • :obey_robots – boolean determining if robots.txt should be honoured. (default: false)
  • :user_agent – user agent string to match in robots.txt (not sent as user_agent of requests yet) (default: cobweb)
  • :crawl_limit_by_page – sets the crawl counter to only use html page types when counting objects crawled
  • :valid_mime_types – an array of mime types that takes wildcards (eg ‘text/*’) defaults to ['*/*']
  • :direct_call_process_job – boolean that specifies whether objects should be passed directly to a processing method or should be put onto a queue
  • :raise_exceptions – defaults to handling exceptions with debug output, setting this to true will raise exceptions in your app
  • :use_encoding_safe_process_job – Base64-encode the body when storing job in queue; set to true when you are expecting non-ASCII content (Default: false)
  • :proxy_addr – hostname of a proxy to use for crawling (e. g., ‘myproxy.example.net’, default: nil)
  • :proxy_port – port number of the proxy (default: nil)
  • :treat_https_as_http – determines whether https and http urls are treated as the same (defaults to true, ie treated as the same)
crawler = Cobweb.new(:follow_redirects => false)

start(base_url)

Starts a crawl through resque. Requires the :processing_queue to be set to a valid class for the resque job to work with the data retrieved.

  • base_url – the url to start the crawl from

Once the crawler starts, if the first page is redirected (eg from http://www.test.com to http://test.com) then the endpoint scheme, host and domain is added to the internal_urls automatically.

crawler.start("http://www.google.com/")

get(url)

Simple get that obey’s the options supplied in new.

  • url – url requested
crawler.get("http://www.google.com/")

head(url)

Simple get that obey’s the options supplied in new.

  • url – url requested
crawler.head("http://www.google.com/")

Processing Queue

The :processing_queue option is used to specify the class that contains the resque perform method to pass the content onto. This class should be defined in your application to perform any tasks you wish to the content. There are two options however, for running this. Firstly, the default settings will push the content crawled onto a resque queue for that class. This allows you the flexibility of running in queues on seperate machines etc. The main drawback to this is that all your content is stored in redis within the queue. This can be memory intensive if you are crawling large sites, or have large content that is being crawled. To get around this you can specify that the crawl_job calls the perform method on the processing queue class directly, thereby not using memory in redis for the content. This is performed by using the :direct_call_process_job. If you set that option to ‘true’ then instead of the job being queued, it will be executed within the crawl_job queue.

CobwebCrawler

CobwebCrawler is the standalone crawling class. If you don’t want to use resque or sidekiq and just want to crawl the site within your ruby process, you can use this class.

crawler = CobwebCrawler.new(:cache => 600)
statistics = crawler.crawl("http://www.pepsico.com")

You can also run within a block and get access to each page as it is being crawled.

statistics = CobwebCrawler.new(:cache => 600).crawl("http://www.pepsico.com") do |page|
  puts "Just crawled #{page[:url]} and got a status of #{page[:status_code]}."
end
puts "Finished Crawl with #{statistics[:page_count]} pages and #{statistics[:asset_count]} assets."

There are some specific options for CobwebCrawler in addition to the normal cobweb options

  • thread_count – specifies the number of threads used by the crawler, defaults to 1

CobwebCrawlHelper

The CobwebCrawlHelper class is a helper class to assist in getting information about a crawl and to perform functions against the crawl

crawl = CobwebCrawlHelper.new(options)
  • options – the hash of options passed into Cobweb.new (must include a :crawl_id)

Contributing/Testing

Firstly, you could Buy Me A Coffee

Feel free to contribute small or large bits of code, just please make sure that there are rspec test for the features your submitting. We also test on travis at http://travis-ci.org/#!/stewartmckee/cobweb if you want to see the state of the project. Continuous integration testing is performed by the excellent Travis: http://travis-ci.org/#!/stewartmckee/cobweb

Todo

  • Tidy up classes with link parsing
  • Refactoring of code to simplify design
  • Remove requirement of redis from standalone crawler
  • Add redis settings to standalone crawler (ie to connect to remote redis)
  • Add ability to start and stop crawls from web interface
  • Allow crawler to start as web interface only (ie not run crawls at start)
  • Fix content encoding issue requiring separate process job
  • DRY the cobweb get/head calls, its got a lot of duplication
  • Investigate using event machine for single threaded crawling

Big changes

  • Refactor into a module and refactor class names to remove cobweb and increase simplicity

License

The MIT License

Copyright © 2013 Active Information Design

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.

cobweb's People

Contributors

adrianouno avatar fqxp avatar gh2k avatar gushonorato avatar markprovan avatar maxehmookau avatar mqzhang avatar peric avatar pisaacs avatar rojotek avatar stewartmckee avatar thomasdavis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar

cobweb's Issues

Code organization

Hi, first I want to say thank you for sharing this crawler and for the work you put in it.

Here is our experience with it and thoughts for improvements. I would be happy to know if you agree and if you would like to get this implemented (we can contribute of course).

We have a repository of code, we use for doing lots of data processing using resque.
We tried to use cobweb within our repository and here are our issues:

  1. name conflicts, classes are declared on a global level. Classes declared in cobweb should be name-spaced in a module. Example: Cobweb::Stats
  2. Sinatra loaded by default. We run our code on multiple machines with multiple processes. As I understand sinatra's purpose is to provide a UI for stats. We don't need/want it to be loaded every time on all boxes consuming memory and slowing down the boot time of our app. So this should be optional (example: 'require cobweb-web' or separate gem).
  3. files directive in gemspec. Everything you put in the files directive, can be loaded automatically. This again exposes naming conflicts. For example we use Fozzie that declares Stats module. But when you do 'require stats', you don't know which one is going to be loaded.
  4. sidekick vs resque, could be optional programmers decision and I would avoid auto detection
  5. logging should be configurable and puts statements should not be used. ruby Cobwbeb.logger = Logger.new

In conclusion this is what i have in mind:

require 'cobweb-resque'
# OR
require 'cobweb-sidekick'
require 'cobweb-web' # optional
Cobweb.logger = Logger.new("crawler.log")

external_urls not treated as external

External urls are not treated as external if they match the cache. A test should be done when retrieving from the cache to make sure that all criteria are checked as it may have changed since last crawl.

Should it be possible to add "depth" in the data hash ?

Hello,

As far as I can see, the generated hash for each page doesn't include the "depth" information, that is to say how many clicks from the homepage each page is distant.
Do you think it could be possible to add this option in the hash ?
By the way, I really appreciate your gem, good work Stewart !

Thanks.

Encoding problems

Regardless from sidekiq or resque, I always get this error:

crawl_id: fdc9cd1655a54b3d303e2f38a916cc114c9be2c7
url: https://github.com/stewartmckee/cobweb/blob/master/.ruby-version
processing_queue: CrawlerResqueJob
crawl_finished_queue: CrawlerFinishedJob
internal_urls:
- https://github.com/stewartmckee/cobweb/blob/master/*
debug: true
raise_exceptions: true
redis_options:
  host: localhost
  port: '6379'
use_encoding_safe_process_job: false
follow_redirects: true
redirect_limit: 10
queue_system: resque
quiet: true
cache: 300
cache_type: crawl_based
timeout: 10
external_urls: []
seed_urls: []
first_page_redirect_internal: true
text_mime_types:
- text/*
- application/xhtml+xml
obey_robots: false
user_agent: cobweb/1.0.18 (ruby/1.9.3 nokogiri/1.6.0)
valid_mime_types:
- ! '*/*'
store_inbound_links: false
crawl_limit_by_page: false
parent: https://github.com/stewartmckee/cobweb/blob/master/
Exception
Encoding::UndefinedConversionError
Error
"\xC2" from ASCII-8BIT to UTF-8

The only workaround possible is to make this crawler work is to do it from inside Rails... which is a pity since I planned to build a service - without rails - integrating this crawler in my project.

Sidekiq doesnt work from inside Rails neither...

On the other hand, this error does not occur (Resque) when the encoding_flash is setup but then the process job is not being executed.

Improve connection handling

Seem to have issues with connections to redis sometimes under load, need to give ability to specify your own redis and and check handling of dropped connections.

Falling into Crawl Traps

Hi,

To start, thank you for an excellent piece of work. Appreciated.

I'm trying to use this to crawl the site http://www.udemy.com/ . I added it to my Gemfile, bundle install and started it up and everything looked great. What I found was that it fell victim to crawl traps generating urls like this:

https://www.udemy.com/courses/photography/mobile-photography/all-courses/?p=324

The actual number pages on the base url:

https://www.udemy.com/courses/photography/mobile-photography/all-courses/

is only 3 so its very much spidering far, far deeper than needed.

Any suggestions for how to go about addressing this?

What I'm trying to do is build a page_archiver and my core loop looks like this (its being executed from a Rake task):

statistics = CobwebCrawler.new(:cache => 600, :thread_count => 10, :valid_mime_types => ["text/html"]).crawl("http://www.udemy.com") do |page|
  puts "Just crawled #{page[:url]} and got a status of #{page[:status_code]}."
  if page[:mime_type] == "text/html"
    page_ctr = page_ctr + 1
    #puts page.title
    #debugger
    page_archive = PageArchive.find_or_create(page[:body], page[:url])
    total_time = (Time.now - start_time) 
    puts "  Total time: #{total_time}"
    puts "  Total pages: #{page_ctr}"
    puts "  Time per page: #{total_time.to_f / page_ctr}"
  else
    puts "  Not text/html for: #{page[:url]}"
  end
  
end

After running it for about 20 minutes, it got 10,000 "pages" deep almost all of which was just "psuedo pages" like the ?p=324 url.

I didn't see any kind of configuration option that would limit progress so this feels like something internal to the guts of the crawler but if I've missed something, my bad.

Thanks
Scott

error while installing cobweb-1.0.28.gem: Invalid argument @ rb_sysopen

[OS: Win 7 x64]

ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]

gem install cobweb

Fetching: redis-3.2.1.gem (100%)
Successfully installed redis-3.2.1
Fetching: redis-namespace-1.5.2.gem (100%)
Successfully installed redis-namespace-1.5.2
Fetching: tilt-2.0.1.gem (100%)
Successfully installed tilt-2.0.1
Fetching: haml-4.0.6.gem (100%)
Successfully installed haml-4.0.6
Fetching: rack-protection-1.5.3.gem (100%)
Successfully installed rack-protection-1.5.3
Fetching: sinatra-1.4.6.gem (100%)
Successfully installed sinatra-1.4.6
Fetching: cobweb-1.0.28.gem (100%)
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument @ rb_sysopen - C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/cobweb-1.0.28/spec/samples/sample_site/boxgrid>withsillyname.html

LoadError with version 1.0.26

When using 1.0.26 I get the below message. However, if I set to the prior version of the gem (gem 'cobweb', '1.0.25'), I have no issues starting the rails server.

$ rails s
/Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb_crawler.rb:3:in `require': cannot load such file -- ap (LoadError)
from /Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb_crawler.rb:3:in `<top (required)>'
from /Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb.rb:8:in `require'
from /Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb.rb:8:in `block in <top (required)>'
from /Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb.rb:7:in `each'
from /Users/xxx/.rvm/gems/ruby-2.2.0/gems/cobweb-1.0.26/lib/cobweb.rb:7:in `<top (required)>'

Feature request: Stop crawl at time

Hello -- this looks like a great crawler, but I need a way, when crawling, to max-out crawl times on a per-url basis.

Because of that I recommend two features:

Actually raise exceptions

This would allow me to decide any arbitrary conditions upon which to stop crawling.

require 'cobweb'
require 'securerandom'

def condition
  true if SecureRandom.hex(10).include?("a") # or whatever condition I deem relevant
end

CobwebCrawler.new(:raise_arbitrary_exceptions => true).crawl("http://pepsico.com") do |page|
  puts "Just crawled #{page[:url]} and got a status of #{page[:status_code]}."
  raise MyCustomError, "message" if condition
end
Just crawled http://www.pepsico.com/ and got a status of 200.
# ... eventually condition is met ...
MyCustomError: message
        from (somewhere):3
# ...

Encode crawl stop options

This would be a higher level way of enshrining these as features, and would be a lot cleaner overall.

require 'cobweb'

pages = 0
puts Time.now #=> 2017-04-19 13:33:11 +0100 

CobwebCrawler.new(:max_pages => 1000, :max_time => 360).crawl("http://pepsico.com") do |page|
  pages += 1
end
puts "Stopped after #{pages} pages at #{Time.now}"
#=> Stopped after 1000 pages at 2017-04-19 13:36:25 +0100
# (... or some other time that is not more than 360 seconds from start time)

Ideally :max_time would accept DateTime, Time or Integer objects, where the integer would represent seconds.

I'm totally new to this project, so feel free to let me know if these are crazy requests. I'm happy to help make this too, if you can give me a pointer as to where this would start out.

undefined method `banner' for main:Object (NoMethodError) on calling from command line

Hi,

I'm getting the following error when I try to use cobweb from command line. Here is the full stack trace:

#<Gem::Specification name=sidekiq version=4.1.4>
/Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/gems/cobweb-1.1.0/bin/cobweb:13:in `block in <top (required)>': undefined method `banner' for main:Object (NoMethodError)
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/gems/slop-4.3.0/lib/slop/options.rb:33:in `initialize'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/gems/slop-4.3.0/lib/slop.rb:23:in `new'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/gems/slop-4.3.0/lib/slop.rb:23:in `parse'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/gems/cobweb-1.1.0/bin/cobweb:12:in `<top (required)>'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/bin/cobweb:23:in `load'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/bin/cobweb:23:in `<main>'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/bin/ruby_executable_hooks:15:in `eval'
    from /Users/gustavo/.rvm/gems/ruby-2.3.1@site-shift/bin/ruby_executable_hooks:15:in `<main>'

The error occurs when I simply call cobweb --help.

I'm using:

  1. Sidekiq 4.1.4
  2. Redis Server 2.8.19

Is there anything I'm missing?

Thanks in advance,
Gustavo

Error raised when there's a valid <base> tag in <head>

After several years of happy operation our Cobweb-dependent crawler ran into a page at https://sso.cas.org/ where the <head> contains this <base> tag:

<base href="https://sso.cas.org/"/>

Our log file was reporting

Error loading http://our.example.com/url: undefined method `present?' for "https://sso.cas.org/":String

and I believe I've traced the problem to a bug in Cobweb's lib/content_link_parser.rb. In the code

14    if @doc.at("base[href]")
15      @base_url = @doc.at("base[href]").attr("href").to_s if @doc.at("base[href]").attr("href").to_s.present?
16    end

I believe the second line is intended to be:

15      @base_url = @doc.at("base[href]").attr("href").to_s if @doc.at("base[href]").attr("href").present?

though I haven't been under the hood in Cobweb before and may be misunderstanding what you're trying to do.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can image, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Error on first run

Running cobweb, I get this:

/Library/Ruby/Gems/2.0.0/gems/cobweb-1.1.0/bin/cobweb:13:in `block in <top (required)>': undefined method `banner' for main:Object (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/slop-4.2.1/lib/slop/options.rb:33:in `initialize'
    from /Library/Ruby/Gems/2.0.0/gems/slop-4.2.1/lib/slop.rb:23:in `new'
    from /Library/Ruby/Gems/2.0.0/gems/slop-4.2.1/lib/slop.rb:23:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/cobweb-1.1.0/bin/cobweb:12:in `<top (required)>'
    from /usr/local/bin/cobweb:23:in `load'
    from /usr/local/bin/cobweb:23:in `<main>'

I don't know what to do.

`require': cannot load such file -- resque (LoadError)

Even though I don't use Resque in my project (I use Sidekiq) I get the following, when trying to start the rails console, after adding Cobweb to my gemfile:

/Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- resque (LoadError)
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/cobweb-1.0.19/lib/cobweb.rb:3:in `<top (required)>'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
  from /Users/NK/Programmering/au/config/application.rb:4:in `<top (required)>'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/railties-4.0.5/lib/rails/commands.rb:60:in `require'
  from /Users/NK/.rvm/gems/ruby-2.0.0-p353@au_rails4/gems/railties-4.0.5/lib/rails/commands.rb:60:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

Cobweb gem causes Rails app to run 10x slower

Hi,

I have a very bare-bones Rails App, and when I add

gem 'cobweb'

to the Gemfile, run 'bundle' and restart, then all web requests take around 15s to execute instead of 1s. The weird thing is that I haven't even started calling Cobweb code at all.

There are no errors and MiniProfiler tells me that no time is begin spent in SQL. It's just much slower.

Any idea on where to start looking? Is the Gem initialising somehow, even if I'm not explicitly calling it?

Using Webrick and PostGres. Ruby 2.2.3 and Rails 4.2.4.

Thanks!

Simon

Redirect Limit causing crawl to stop

When the redirect limit is hit it kills the crawl. The RedirectError is thrown but doesn't seem to be trapped, it seems to be thrown for each subsequent call into the get method, which it shouldn't do because it should check that the redirect_limit has count down to 0.

Inbound links are not normalized when stored

If I call Stats.inbound_links_for(my_url) during parse, sometimes I don't see the correct results. This is due to the fact that the URI being processed during parse has been normalized before fetching the page data, but links are not normalized before having their digests calculated as redis keys.

Standalone Crawler gives error for redis

When trying to use it as stand alone crawler without redis it gives error for redis connection.

If you run this:

crawler = CobwebCrawler.new(:cache => 600)
statistics = crawler.crawl("http://www.pepsico.com")

You will get error Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)

While according to documentation, it should run without requiring redis in this case. Thanks

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.