class TTWatcher::Parsers::Rutor
Private Instance Methods
extract_torrent(unparsed_data)
click to toggle source
@param [Nokogiri::Node] unparsed_data
Surface scan for +rutor+ gives next information about single torrent ++ hsh[:name] ==> ex. "Cats swimming in pool 2016 BDRIP" -- hsh[:description] ==> ex. "Hot CATS. Summer 2016" ++ hsh[:url] ==> ex. "example.torrent.side/12345" ++ hsh[:tracker] ==> ex. :super_cool_tracker -- hsh[:author] ==> ex. 'Bit kitty fun' ++ hsh[:added_date] ==> ex. '2016-06-15' ++ hsh[:seeders] ==> ex. 50042 ++ hsh[:leeches] ==> ex. 1 ++ hsh[:size] ==> ex. "20000 mb" ++ hsh[:magnet_url] ==> ex. "magnet:?xt=urn....................." ++ hsh[:download_url] ==> ex. "example.torrent.side/12345/download" Where '++' means that field is present.
@return [Torrent]
# File sources/ttwatcher/sites/parsers/rutor_parser.rb, line 44 def extract_torrent(unparsed_data) hsh = Hash.new hsh[:short_link] = unparsed_data.css('a[@class="downgif"]').attribute('href').to_s hsh[:magnet_url] = unparsed_data.css('a')[1].attribute('href').to_s hsh[:url] = unparsed_data.css('a')[2].attribute('href').to_s hsh[:name] = unparsed_data.css('a')[2].text hsh[:added_date] = unparsed_data.css('td')[0].text hsh[:seeders] = unparsed_data.css('td[@align="center"]').css('span')[0].text hsh[:leeches] = unparsed_data.css('td[@align="center"]').css('span')[1].text if (tmp_size = unparsed_data.css('td[@align="right"]')[1]) hsh[:size] = tmp_size.text end hsh[:tracker] = assigned_site.name hsh[:download_url] = assigned_site.address(hsh[:short_link]) hsh[:url] = assigned_site.address(hsh[:url] ) Torrent.new hsh end
new_pages_list()
click to toggle source
# File sources/ttwatcher/sites/parsers/rutor_parser.rb, line 8 def new_pages_list # no-doc return @links if @links.is_a? Array @links = rutor_structure.xpath('b').first.xpath('a').map do |node| node.attribute('href').to_s end end
rutor_structure()
click to toggle source
# File sources/ttwatcher/sites/parsers/rutor_parser.rb, line 20 def rutor_structure # no-doc structure.xpath '//div[@id="index"]' end
torrents_unparsed()
click to toggle source
# File sources/ttwatcher/sites/parsers/rutor_parser.rb, line 16 def torrents_unparsed # no-doc rutor_structure.css('tr[@class="gai"], tr[@class="tum"]') end