Class: DownloadTV::Torrentz
- Inherits:
-
LinkGrabber
- Object
- LinkGrabber
- DownloadTV::Torrentz
- Defined in:
- lib/download_tv/grabbers/torrentz.rb
Overview
Torrentz2 grabber
Instance Attribute Summary
Attributes inherited from LinkGrabber
Instance Method Summary collapse
- #get_links(show) ⇒ Object
-
#initialize ⇒ Torrentz
constructor
A new instance of Torrentz.
Methods inherited from LinkGrabber
Constructor Details
#initialize ⇒ Torrentz
Returns a new instance of Torrentz.
7 8 9 |
# File 'lib/download_tv/grabbers/torrentz.rb', line 7 def initialize super('https://torrentz2.nz/search?q=%s') end |
Instance Method Details
#get_links(show) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/download_tv/grabbers/torrentz.rb', line 11 def get_links(show) raw_data = agent.get(format(@url, show)) results = raw_data.search('dl') raise NoTorrentsError if results.empty? data = results.sort_by { |e| e.search('dd span')[3].text.to_i }.reverse data.collect do |i| [i.children[0].text.strip, i.search('dd span a').first.attribute('href').text] end end |