Skip to content

modbender/tracker-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tracker Scraper

PyPI Python versions Downloads Downloads

A simple BitTorrent tracker scraper — query a tracker for the seeds, peers, and completed counts of one or more torrents, over both UDP and HTTP/HTTPS.

Documentation

Full documentation lives at modbender.in/tracker-scraper.

Installation

pip install tracker-scraper

Usage

Python

from tracker_scraper import scrape

results = scrape(
    tracker="udp://exodus.desync.com:6969",
    hashes=[
        "2d88e693eda7edf3c1fd0c48e8b99b8fd5a820b2",
        "8929b29b83736ae650ee8152789559355275bd5c",
    ],
)

print(results)

scrape(tracker, hashes) returns a dict of dicts. The key is each torrent info_hash from the hashes argument, and the value is a dict with seeds, peers, and complete:

{
  "2d88e693eda7edf3c1fd0c48e8b99b8fd5a820b2": {
    "seeds": 34,
    "peers": 189,
    "complete": 10
  }
}

Arguments

  • tracker (str): the announce URL for a tracker (udp://, http://, or https://), usually taken directly from the torrent metadata.
  • hashes (list[str]): a list of torrent info_hash values to query.

Note: HTTP/HTTPS tracker scraping works from version 1.1 onwards. UDP scrapes are limited to 74 hashes per request.

Command line

Installing the package also adds a tracker-scraper command that prints results as JSON:

tracker-scraper udp://exodus.desync.com:6969 2d88e693eda7edf3c1fd0c48e8b99b8fd5a820b2

Run tracker-scraper --help for all options.

Requirements

Development

pip install -e ".[test]"
pytest

Credits

Code originally adapted from the m2t project by Erin Drummond (erindru). Originally written for Python 2.7; updated to Python 3 and requests.

About

A simple torrent tracker scraper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages