Class: DownloadTV::Eztv

Inherits:
LinkGrabber show all
Defined in:
lib/download_tv/grabbers/eztv.rb

Overview

EZTV.ag grabber

Instance Attribute Summary

Attributes inherited from LinkGrabber

#url

Instance Method Summary collapse

Methods inherited from LinkGrabber

#agent, #online?

Constructor Details

#initializeEztv

Returns a new instance of Eztv.



7
8
9
# File 'lib/download_tv/grabbers/eztv.rb', line 7

def initialize
  super('https://eztvx.to/search/%s')
end

Instance Method Details

Raises:



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/download_tv/grabbers/eztv.rb', line 11

def get_links(show)
  raw_data = agent.get(format(@url, show))
  raw_data = raw_data.forms.last.submit # Show links button
  raw_seeders = raw_data.search('td.forum_thread_post_end').map { |e| e.children[0].text.to_i }
  raw_links = raw_data.search('a.magnet').sort_by.with_index { |_, index| raw_seeders[index] }.reverse

  raise NoTorrentsError if raw_links.size == 0

  raw_links.collect do |i|
    [i.attribute('title').text.chomp(' Magnet Link'),
     i.attribute('href').text]
  end
end