Class: DownloadTV::ThePirateBayAPI
- Inherits:
-
LinkGrabber
- Object
- LinkGrabber
- DownloadTV::ThePirateBayAPI
- Defined in:
- lib/download_tv/grabbers/tpbapi.rb
Overview
ThePirateBay grabber
Constant Summary collapse
- TRACKERS =
%w[ udp://tracker.coppersurfer.tk:6969/announce udp://tracker.openbittorrent.com:6969/announce udp://tracker.opentrackr.org:1337 udp://movies.zsw.ca:6969/announce udp://tracker.dler.org:6969/announce udp://opentracker.i2p.rocks:6969/announce udp://open.stealth.si:80/announce udp://tracker.0x.tf:6969/announce ]
Instance Attribute Summary
Attributes inherited from LinkGrabber
Instance Method Summary collapse
- #get_links(show) ⇒ Object
-
#initialize ⇒ ThePirateBayAPI
constructor
A new instance of ThePirateBayAPI.
Methods inherited from LinkGrabber
Constructor Details
#initialize ⇒ ThePirateBayAPI
Returns a new instance of ThePirateBayAPI.
18 19 20 |
# File 'lib/download_tv/grabbers/tpbapi.rb', line 18 def initialize super("https://tpb36.ukpass.co/apibay/q.php?q=%s&cat=") end |
Instance Method Details
#get_links(show) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/download_tv/grabbers/tpbapi.rb', line 22 def get_links(show) search = format(@url, show) data = agent.get(search) parsed = JSON.parse(data.body) raise NoTorrentsError if parsed.size == 1 && parsed.first['name'] == 'No results returned' parsed.map do |elem| [elem['name'], build_magnet(elem['info_hash'], elem['name'])] end end |