torrent-tracker-scraper

A UDP torrent tracker scraper written in Python 3


Keywords
python, bittorrent, scraping, python3, bittorrent-tracker, bittorrent-protocol
Licenses
LGPL-2.0/LGPL-3.0
Install
pip install torrent-tracker-scraper==1.1.0

Documentation

Torrent Tracker Scraper

A UDP torrent tracker scraper written in Python 3

Coverage SVG PyPI version License: LGPL v3 Build Status

Installation

pip install torrent-tracker-scraper

Usage

The package can be used either as a module within a script or straight up from the commandline.

As a python module

pass in a single infohash

from torrent_tracker_scraper import scraper

scraper = scraper.Scraper("tracker.coppersuffer.tk", 6969, json=True)

results = scraper.scrape("95105D919C10E64AE4FA31067A8D37CCD33FE92D")
print(results)

{'tracker': 'tracker.coppersuffer.tk', 'results': [{'infohash': '95105D919C10E64AE4FA31067A8D37CCD33FE92D', 'seeders': 112, 'completed': 496, 'leechers': 2}]}

pass in multiple infohashes separated by commas

results = scraper.scrape("95105D919C10E64AE4FA31067A8D37CCD33FE92D,913EF55D5DD1A9376B738922E5104B3A1BE3754A")
print(results)

{'tracker': 'tracker.coppersuffer.tk', 'results': [{'infohash': '95105D919C10E64AE4FA31067A8D37CCD33FE92D', 'seeders': 112, 'completed': 496, 'leechers': 2}, {'infohash': '913EF55D5DD1A9376B738922E5104B3A1BE3754A', 'seeders': 334, 'completed': 989, 'leechers': 250}]}

pass in a list of infohashes

results = scraper.scrape(["913EF55D5DD1A9376B738922E5104B3A1BE3754A", "95105D919C10E64AE4FA31067A8D37CCD33FE92D"])
print(results)

{'tracker': 'tracker.coppersuffer.tk', 'results': [{'infohash': '913EF55D5DD1A9376B738922E5104B3A1BE3754A', 'seeders': 334, 'completed': 989, 'leechers': 250}, {'infohash': '95105D919C10E64AE4FA31067A8D37CCD33FE92D', 'seeders': 112, 'completed': 496, 'leechers': 2}]}

From the commandline

python torrent_tracker_scraper/scraper.py -i 45b3d693cff285975f622acaeb75c5626acaff6f

[{'infohash': '45b3d693cff285975f622acaeb75c5626acaff6f', 'seeders': 1, 'completed': 0, 'leechers': 0}]


python torrent_tracker_scraper/scraper.py -i 88334ec1d90afe94a22c6de5756268599f5f8ea2,5b6a484a018beed4d01f2f57e6d029a4190a9d04

[{'infohash': '88334ec1d90afe94a22c6de5756268599f5f8ea2', 'seeders': 3, 'completed': 6, 'leechers': 0}, {'infohash': '5b6a484a018beed4d01f2f57e6d029a4190a9d04', 'seeders': 2, 'completed': 12, 'leechers': 0}]

Get your scrap information

Testing

pipenv install --dev
pipenv shell
python -m pytest

Help/Contributing

Use the normal GitHub bug reporting flow i.e Create an issue here https://github.com/49e94b8f256530dc0d41f740dfe8a4c1/torrent-tracker-scraper/issues.

Fork the code, make your changes and create a pull request.

Behind the scenes

For a detailed quick rundown of whats going on behind the scenes

https://blog.takeshispalace.com/programming/python3/udp/2018/12/23/udp-torrent-scraper-python.html

Contributors

https://github.com/dessalines