1

编辑**这篇文章中,Jon 提到他希望在 2.0 中摆脱并发,而是在应用程序中传递单个 url 并处理并发,工人是可能的方法。

我正在尝试使用FeedJira(使用fardaygem)解析多个 URL,但收到参数错误。过去有没有人成功解析过一个以上的 URL?FeedJira::Feed的来源声明它将返回单个提要 URL 或提要 URL 数组。

.fetch_and_parse(urls, options = {}) ⇒ Object

脚本

feed_urls = ["https://jobs.startupnorth.ca/jobs.rss", "https://jobs.startupnorth.ca/jobs.rss"]
feed = Feedjira::Feed.fetch_and_parse(feed_urls)

错误

ArgumentError: bad argument (expected URI object or URI string)
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/faraday-0.15.0/lib/faraday/utils.rb:277:in `URI'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/faraday-0.15.0/lib/faraday/connection.rb:315:in `url_prefix='
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/faraday-0.15.0/lib/faraday/connection.rb:80:in `initialize'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/faraday-0.15.0/lib/faraday.rb:70:in `new'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/faraday-0.15.0/lib/faraday.rb:70:in `new'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/feedjira-2.1.4/lib/feedjira/feed.rb:82:in `connection'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/feedjira-2.1.4/lib/feedjira/feed.rb:68:in `fetch_and_parse'
    from (irb):144
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/console.rb:65:in `start'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/console_helper.rb:9:in `start'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands.rb:18:in `<top (required)>'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `require'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in `require'
    from /Users/taylorcooney/code/startupjobstoronto/bin/rails:9:in `<top (required)>'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:in `load'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:in `block in load'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:in `load'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/taylorcooney/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
4

1 回答 1

1

此方法在 2.0.0 版中已更改。确保您使用的是 < 2 的版本。

于 2018-05-14T10:29:06.187 回答