class RSSable::Processor

Public Class Methods

call(url:) click to toggle source
# File lib/rssable/processor.rb, line 3
def self.call(url:)
  # Returns the RSSable::Parsers::Channel instance
  # If the feed URL is not detected it returns nil
  #
  # @return [RSSable::Parsers::Channel]
  urls = RSSable::Detection::FeedFinder.call(url: url)
  feed_url, driver = RSSable::Detection::EngineDetector.call(
    urls: urls, source_url: url
  )

  return if feed_url.nil?

  response = RestClient.get(feed_url)

  RSSable::Parsers::Channel.new(
    feed: response.body, driver: driver
  )
rescue RestClient::NotFound
end