class DownloadTV::KAT
KATcr.co grabber
Attributes
max_tries[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/download_tv/grabbers/kat.rb, line 9 def initialize super('https://katcr.co/advanced-usearch/') @max_tries = 5 end
Public Instance Methods
get_links(show)
click to toggle source
# File lib/download_tv/grabbers/kat.rb, line 14 def get_links(show) tries = 0 params = { 'category': 'TV', 'orderby': 'seeds-desc', 'search': show } data = @agent.post(@url, params) .search('tbody tr td[1]') names = data.map do |i| i.search('a.torrents_table__torrent_title b') .text end links = data.map do |i| i.search('div.torrents_table__actions a[3]') .first .attribute('href') .text end raise NoTorrentsError if data.empty? names.zip(links) rescue Net::HTTP::Persistent::Error => e raise unless e.message =~ /too many connection resets/ raise if tries >= @max_tries tries += 1 retry end