lib/download_tv/grabbers/eztv.rb in download_tv-2.2.1 vs lib/download_tv/grabbers/eztv.rb in download_tv-2.2.2
- old
+ new
@@ -1,30 +1,27 @@
module DownloadTV
- class Eztv < LinkGrabber
- def initialize
- super("https://eztv.ag/search/%s")
- end
+ ##
+ # EZTV.ag grabber
+ class Eztv < LinkGrabber
+ def initialize
+ super('https://eztv.ag/search/%s')
+ end
- def get_links(s)
+ def get_links(s)
+ # Format the url
+ search = format(@url, s)
- # Format the url
- search = @url % [s]
+ data = @agent.get(search).search('a.magnet')
- data = @agent.get(search).search("a.magnet")
+ # Torrent name in data[i].attribute 'title'
+ # 'Suits S04E01 HDTV x264-LOL Torrent: Magnet Link'
- # Torrent name in data[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 data.size == 50
- # EZTV shows 50 latest releases if it can't find the torrent
- raise NoTorrentsError if data.size == 50
+ names = data.collect { |i| i.attribute('title').text.chomp(' Magnet Link') }
+ links = data.collect { |i| i.attribute('href').text }
- names = data.collect { |i| i.attribute("title").text.chomp(" Magnet Link") }
- links = data.collect { |i| i.attribute("href").text }
-
- names.zip(links)
-
- end
-
-
- end
-
+ names.zip(links)
+ end
+ end
end