class RSSable::Detection::FeedFinder

Public Class Methods

call(url:) click to toggle source

It returns array of RSS feed links for given URL

@return [Array<String>]

# File lib/rssable/detection/feed_finder.rb, line 7
def self.call(url:)
  response = RestClient.get(url)
  html = Nokogiri::HTML(response.body)

  links = html.css("link[type='application/rss+xml']").map { |node| node[:href] }
  
  return links if links.size > 0

  url.end_with?('/') ? ["#{url}feed/"] : ["#{url}/feed/"]
end