class DownloadTV::LinkGrabber
Interface for the grabbers
Attributes
url[R]
Public Class Methods
new(url)
click to toggle source
# File lib/download_tv/linkgrabber.rb, line 9 def initialize(url) @url = url @agent = Mechanize.new do |a| a.user_agent = DownloadTV::USER_AGENT a.read_timeout = 10 end end
Public Instance Methods
get_links(_show)
click to toggle source
# File lib/download_tv/linkgrabber.rb, line 29 def get_links(_show) raise NotImplementedError end
online?()
click to toggle source
# File lib/download_tv/linkgrabber.rb, line 17 def online? url = if @url.include? '%s' format(@url, 'test') else @url end @agent.head(url) true rescue Mechanize::ResponseCodeError, Net::HTTP::Persistent::Error, Errno::ECONNRESET false end