Python library for searching thepiratebay.org
pip install the-python-bayfrom the_python_bay import tpb
results = tpb.search("ubuntu")This will return the a list of instances of the Torrent class.
So you can then access the data like so:
for torrent in results:
print(f"{torrent.name} - {torrent.magnet}")This can be used to search thepiratebay.org, it will return a list of instances of the Torrent class.
from the_python_bay import tpb
results = tpb.search("ubuntu")Can be used to return the current top 100 movies on thepiratebay.org
from the_python_bay import tpb
results = tpb.top_movies()Can be used to return the current top 100 tv on thepiratebay.org
from the_python_bay import tpb
results = tpb.top_tv()The Torrent class is the format the torrents are returned in, it has the following attributes:
namethe torrents namemagentthe torrents magnet linkseedersnumber of seeders the torrent hasusernamethe username of the torrents uploaderstatusthe users prominence status
Torrent also has the property to_dict that can he used to return the dict of the the object. It can be used more generally:
from the_python_bay import tpb
results = tpb.search_dict("ubuntu")Or it can be used on a specific Torrent object like so:
from the_python_bay import tpb
results = tpb.search("ubuntu")
for torrent in results:
print(torrent.to_dict)Or even more directly:
torrent = Torrent(data)
torrent.to_dict