rubycdp / vessel

Fast high-level web crawling Ruby framework
https://vessel.rubycdp.com
MIT License
645 stars 11 forks source link

Fix driver start #18

Closed milk1000cc closed 2 years ago

milk1000cc commented 2 years ago

It seems that Vessel::Driver#initialize is not calling #start properly. Ruby version is 3.0.2.

Sample

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'vessel', github: 'rubycdp/vessel'
end

class ExampleCom < Vessel::Cargo
  start_urls 'https://example.com/'

  def parse
    puts page.at_css('h1').text
  end
end

ExampleCom.run

Result

/Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/driver/ferrum/driver.rb:20:in `start': wrong number of arguments (given 1, expected 0) (ArgumentError)
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/driver.rb:26:in `initialize'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/driver.rb:15:in `new'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/driver.rb:15:in `build'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/scheduler.rb:18:in `initialize'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/engine.rb:16:in `new'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/engine.rb:16:in `initialize'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/engine.rb:6:in `new'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/engine.rb:6:in `run'
        from /Users/milk1000cc/dev/vessel_sample/vendor/bundle/ruby/3.0.0/bundler/gems/vessel-99e042c5bd91/lib/vessel/cargo.rb:16:in `run'
        from scrape.rb:16:in `<main>'
route commented 2 years ago

Thanks!