Module: BTScraper

Defined in:
lib/btscraper.rb,
lib/btscraper/udpscrape.rb,
lib/btscraper/httpscrape.rb,
lib/btscraper/checkinfohash.rb

Overview

Scrape library for bittorrent trackers

Author:

  • sherkix

Defined Under Namespace

Classes: BTScraperError, HTTPScrape, UDPScrape

Constant Summary collapse

Connection_id =

Magic Constant

0x41727101980
Actionconn =

Connection Request

0
Actionscrape =

Scrape Request

2
Actionerr =

Scrape Error

3
Defaulttimeout =

Default timeout is 15s

15
Retries =

Maximum number of retransmission

8
Sha1_regex =

Regex to check SHA1 infohashes

/^[0-9a-f]{40}$/

Class Method Summary collapse

Class Method Details

.check_info_hash(info_hash) ⇒ Object

This method checks if the infohashes are valid

Raises:



6
7
8
# File 'lib/btscraper/checkinfohash.rb', line 6

def self.check_info_hash(info_hash)
  info_hash.each{|x| raise BTScraperError, 'Invalid infohash provided' unless x.match?(Sha1_regex)}
end