Home
Installation
Install with pip
pip install 1337x
Install from source
pip install git+https://github.com/hemantapkh/1337x
Examples
Temporary Search Limitation
Due to a recent change on the 1337x website, using the .search() method without a category may return empty results. Specifying a category is temporarily recommended to ensure functionality.
Searching Torrents
import py1337x
torrents = py1337x.Py1337x()
# Basic search
results = torrents.search(
'ubuntu',
page=1,
category=py1337x.category.APPS
)
for result in results.items:
print(f"Title={result.name} Seeders={result.seeders}")
# Search with sorting by seeders
results = torrents.search('vlc', sort_by=py1337x.sort.SEEDERS, category=py1337x.category.APPS)
print(results)
# Get today's trending torrents
results = torrents.trending()
print(results)
Getting Torrent Information
To get magnetlink and other information of the torrent.
# Getting info the the first result of the above search
torrent_id = results.items[0].torrent_id
info = torrents.info(torrent_id=torrent_id)
print(info)
# Convert the result to dictionary
info_dict = info.to_dict()
print(info_dict)
Asynchronous Usage
For asynchronous usage, all functionalities are the same; use AsyncPy1337x instead of Py1337x:
import asyncio
from py1337x import AsyncPy1337x
async def main():
torrents = AsyncPy1337x()
results = await torrents.search('vlc media player')
print(results)
asyncio.run(main())
Next Steps
Now that you've seen the basics, you can explore the full API reference for a detailed guide to every available method.
- API Reference:
- Synchronous Client
- Asynchronous Client
- Data Models
- License: This project is licensed under the MIT License.
- Contributing: Contributions are welcome! Please see the project on GitHub.