Class: DownloadTV::Eztv
- Inherits:
-
LinkGrabber
- Object
- LinkGrabber
- DownloadTV::Eztv
- Defined in:
- lib/download_tv/grabbers/eztv.rb
Overview
EZTV.ag grabber
Instance Attribute Summary
Attributes inherited from LinkGrabber
Instance Method Summary collapse
- #get_links(show) ⇒ Object
-
#initialize ⇒ Eztv
constructor
A new instance of Eztv.
Methods inherited from LinkGrabber
Constructor Details
#initialize ⇒ Eztv
Returns a new instance of Eztv.
7 8 9 |
# File 'lib/download_tv/grabbers/eztv.rb', line 7 def initialize super('https://eztv.ag/search/%s') end |
Instance Method Details
#get_links(show) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/download_tv/grabbers/eztv.rb', line 11 def get_links(show) # Format the url search = format(@url, show) raw_data = @agent.get(search) raw_links = raw_data.search('a.magnet') raw_seeders = raw_data.search('td.forum_thread_post_end').map { |e| e.children[0].text.to_i } raw_links = raw_links.sort_by.with_index { |_, index| raw_seeders[index] }.reverse # Torrent name in raw_links[i].attribute 'title' # 'Suits S04E01 HDTV x264-LOL Torrent: Magnet Link' # EZTV shows 50 latest releases if it can't find the torrent raise NoTorrentsError if raw_links.size == 50 names = raw_links.collect do |i| i.attribute('title') .text .chomp(' Magnet Link') end links = raw_links.collect do |i| i.attribute('href') .text end names.zip(links) end |