<h2 align='center'>✖️Unofficial Python API Wrapper of 1337x</h2>
<p align="center">
<img src="https://github.com/hemantapkh/1337x/blob/main/images/1337x.png?raw=true" align="center" height=205 alt="1337x" />
</p>
<p align="center">
<a href="https://pypi.org/project/1337x">
<img src='https://img.shields.io/pypi/v/1337x.svg'>
</a>
<a href="https://pepy.tech/project/1337x">
<img src='https://pepy.tech/badge/1337x'>
</a>
<img src='https://visitor-badge.laobi.icu/badge?page_id=hemantapkh.1337x'>
<a href="https://github.com/hemantapkh/1337x/stargazers">
<img src="https://img.shields.io/github/stars/hemantapkh/1337x" alt="Stars"/>
</a>
<a href="https://github.com/hemantapkh/1337x/issues">
<img src="https://img.shields.io/github/issues/hemantapkh/1337x" alt="Issues"/>
</a>
<p align="center">
This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You can search, get trending, top and popular torrents. Furthermore, you can browse torrents of a certain category. It also supports filtering on result by category, supports sorting and caching.
<p align="center">
## Table of Contents
- [Installation](#installation)
- [Start Guide](#start-guide)
- [Quick Examples](#quick-examples)
- [Searching Torrents](#1-searching-torrents)
- [Getting Trending Torrents](#2-getting-trending-torrents)
- [Getting information of a torrent](#3-getting-information-of-a-torrent)
- [Detailed Documentation](#detailed-documentation)
- [Available attributes](#available-attributes)
- [Available methods](#available-methods)
- [Available category](#available-categories)
- [Available sorting methods](#available-sorting-methods)
- [Contributing](#contributing)
- [Projects using this API](#projects-using-this-api)
- [License](#license)
## Installation
- Install via [PyPi](https://www.pypi.org/project/1337x)
```bash
pip install 1337x
```
- Install from the source
```bash
git clone https://github.com/hemantapkh/1337x && cd 1337x && python setup.py sdist && pip install dist/*
```
## Start guide
### Quick Examples
#### 1. Searching torrents
```python
>>> from py1337x import py1337x
# Using 1337x.tw and saving the cache in sqlite database which expires after 500 seconds
>>> torrents = py1337x(proxy='1337x.to', cache='py1337xCache', cacheTime=500)
>>> torrents.search('harry potter')
{'items': [...], 'currentPage': 1, 'itemCount': 20, 'pageCount': 50}
# Searching harry potter in category movies and sort by seeders in descending order
>>> torrents.search('harry potter', category='movies', sortBy='seeders', order='desc')
{'items': [...], 'currentPage': 1, 'itemCount': 40, 'pageCount': 50}
# Viewing the 5th page of the result
>>> torrents.search('harry potter', page=5)
{'items': [...], 'currentPage': , 'itemCount': 20, 'pageCount': 50}
```
#### 2. Getting Trending Torrents
```python
>>> from py1337x import py1337x
# Using the default proxy (1337x.to) Without using cache
>>> torrents = py1337x()
# Today's trending torrents of all category
>>> torrents.trending()
{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}
# Trending torrents this week of all category
>>> torrents.trending(week=True)
{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}
# Todays trending anime
>>> torrents.trending(category='anime')
{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}
# Trending anime this week
>>> torrents.trending(category='anime', week=True)
{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}
```
#### 3. Getting information of a torrent
```python
>>> from py1337x import py1337x
# Using 11337x.st and passing the cookie since 11337x.st is cloudflare protected
>>> torrents = py1337x('11337x.st', cookie='<cookie>')
# Getting the information of a torrent by its link
>>> torrents.info(link='https://www.1337xx.to/torrent/258188/h9/')
{'name': 'Harry Potter and the Half-Blood Prince', 'shortName': 'Harry Potter', 'description': "....", 'category': 'Movies', 'type': 'HD', 'genre': ['Adventure', 'Fantasy', 'Family'], 'language': 'English', 'size': '3.0 GB', 'thumbnail': '...', 'images': [...], 'uploader': ' ...', 'uploaderLink': '...', 'downloads': '5310', 'lastChecked': '44 seconds ago', 'uploadDate': '4 years ago', 'seeders': '36', 'leechers': '3', 'magnetLink': '...', 'infoHash': '...'}
# Getting the information of a torrent by its link
>>> torrents.info(torrentId='258188')
{'name': 'Harry Potter and the Half-Blood Prince', 'shortName': 'Harry Potter', 'description': "....", 'category': 'Movies', 'type': 'HD', 'genre': ['Adventure', 'Fantasy', 'Family'], 'language': 'English', 'size': '3.0 GB', 'thumbnail': '...', 'images': [...], 'uploader': ' ...', 'uploaderLink': '...', 'downloads': '5310', 'lastChecked': '44 seconds ago', 'uploadDate': '4 years ago', 'seeders': '36', 'leechers': '3', 'magnetLink': '...', 'infoHash': '...'}
```
## Detailed documentation
## Available attributes
```python
from py1337x import py1337x
torrents = py1337x(proxy='1337x.st', cookie='<cookie>', cache='py1337xCache', cacheTime=86400, backend='sqlite')
```
**Proxy**
If the default domain is banned in your country, you can use an alternative domain of 1337x.
- [`1337x.to`](https://1337x.to) (**default**)
- [`1337x.st`](https://1337x.st)
- [`x1337x.ws`](https://x1337x.ws)
- [`x1337x.eu`](https://x1337x.eu)
- [`x1337x.se`](https://x1337x.se)
- [`1337x.so`](https://1337x.so)
- [`1377x.to`](https://www.1377x.to) (unofficial)
- [`1337xx.to`](https://www.1337xx.to) (unofficial)
**cookie**
Some of the proxies are protected with Cloudflare. For such proxies you need to pass a cookie value. To get a cookie go the the protected site from your browser, solve the captcha and copy the value of `cf_clearance`.
``Firefox: Inspect element > Storage > Cookies`` <br>
``Chrome: Inspect element > Application > Storage > Cookies``
**cache**
Py1337x uses [requests-cache](https://pypi.org/project/requests-cache/) for caching to store data so that future requests for that data can be served faster. `cache` can be any of the following.
- A boolean value: `True` for using cache and `False` for not using cache. (**cache is not used by default**)
- Directory for storing the cache.
**cacheTime**
By default the cache expires after one day. You can change the cache expiration time by setting a custom `cacheTime`.
- `-1` (to never expire)
- `0` (to “expire immediately,” e.g. bypass the cache)
- A positive number (in seconds [**defaults to 86400**])
- A [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta)
- A [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime)
**backend**
The backend for storing the cache can be any of the following.
- `'sqlite'`: SQLite database (**default**)
- `'redis'`: Redis cache (`requires redis`)
- `'mongodb'`: MongoDB database (`requires pymongo`)
- `'gridfs'`: GridFS collections on a MongoDB database (`requires pymongo`)
- `'dynamodb'`: Amazon DynamoDB database (`requires boto3`)
- `'memory'`: A non-persistent cache that just stores responses in memory
## Available methods
```python
from py1337x import py1337x
torrents = py1337x()
```
Method | Description | Arguments
----------|-------------|-----------
torrents.search(query) | Search for torrents | self,<br>query: `Keyword to search for`,<br>page (Defaults to 1): `Page to view`,<br>category (optional): [category](#available-categories),<br>sortBy (optional): [Sort by](#available-sorting-methods),<br>Order (optional): [order](#available-sorting-order)
torrents.trending() | Get trending torrents | self,<br>category (optional): [category](#available-categories),<br>week (Defaults to False): `True for weekely, False for daily`
torrents.top() | Get top torrents | self,<br>category (optional): [category](#available-categories)
torrents.popular(category) | Get popular torrents | self,<br>category: [category](#available-categories),<br>week (Defaults to False): `True for weekely, False for daily`
torrents.browse(category) | Browse browse of certain category | self,<br>category: [category](#available-categories),<br>page (Defaults to 1): `Page to view`
torrents.info(link or torrentId) | Get information of a torrent | self,<br>link: `Link of a torrent` or<br>torrentId: `ID of a torrent`
### Available categories
- `'movies'`
- `'tv'`
- `'games'`
- `'music'`
- `'apps'`
- `'anime'`
- `'documentaries'`
- `'xxx'`
- `'others'`
### Available sorting methods
- `'time'`
- `'size'`
- `'seeders'`
- `'leechers'`
### Available sorting order
- `'desc'` (for descending order)
- `'asc'` (for ascending order)
## Contributing
Any contributions you make are **greatly appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
*Thanks to every [contributors](https://github.com/hemantapkh/1337x/graphs/contributors) who have contributed in this project.*
## Projects using this API
* [Torrent Hunt](https://github.com/hemantapkh/torrenthunt) - Telegram bot to search torrents.
Want to list your project here? Just make a pull request.
## License
Distributed under the MIT License. See [LICENSE](https://github.com/hemantapkh/1337x/blob/main/LICENSE) for more information.
-----
Author/Maintainer: [Hemanta Pokharel](https://github.com/hemantapkh/) | Youtube: [@H9Youtube](https://youtube.com/h9youtube)
Raw data
{
"_id": null,
"home_page": "https://github.com/hemantapkh/1337x",
"name": "1337x",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "1337x, torrents",
"author": "Hemanta Pokharel",
"author_email": "hemantapkh@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/a8/6b/9237d0bd8bdd98c3e1206e5a149fd916b0d7a8216bf9c11f43ee402ee37e/1337x-1.2.6.tar.gz",
"platform": null,
"description": "\n<h2 align='center'>\u2716\ufe0fUnofficial Python API Wrapper of 1337x</h2>\n<p align=\"center\">\n<img src=\"https://github.com/hemantapkh/1337x/blob/main/images/1337x.png?raw=true\" align=\"center\" height=205 alt=\"1337x\" />\n</p>\n<p align=\"center\">\n<a href=\"https://pypi.org/project/1337x\">\n<img src='https://img.shields.io/pypi/v/1337x.svg'>\n</a>\n<a href=\"https://pepy.tech/project/1337x\">\n<img src='https://pepy.tech/badge/1337x'>\n</a>\n<img src='https://visitor-badge.laobi.icu/badge?page_id=hemantapkh.1337x'>\n<a href=\"https://github.com/hemantapkh/1337x/stargazers\">\n<img src=\"https://img.shields.io/github/stars/hemantapkh/1337x\" alt=\"Stars\"/>\n</a>\n<a href=\"https://github.com/hemantapkh/1337x/issues\">\n<img src=\"https://img.shields.io/github/issues/hemantapkh/1337x\" alt=\"Issues\"/>\n</a>\n\n<p align=\"center\">\nThis is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You can search, get trending, top and popular torrents. Furthermore, you can browse torrents of a certain category. It also supports filtering on result by category, supports sorting and caching.\n<p align=\"center\">\n\n## Table of Contents\n- [Installation](#installation)\n- [Start Guide](#start-guide)\n - [Quick Examples](#quick-examples) \n - [Searching Torrents](#1-searching-torrents)\n - [Getting Trending Torrents](#2-getting-trending-torrents)\n - [Getting information of a torrent](#3-getting-information-of-a-torrent)\n- [Detailed Documentation](#detailed-documentation)\n - [Available attributes](#available-attributes)\n - [Available methods](#available-methods) \n - [Available category](#available-categories)\n - [Available sorting methods](#available-sorting-methods)\n- [Contributing](#contributing)\n- [Projects using this API](#projects-using-this-api)\n- [License](#license)\n\n## Installation\n- Install via [PyPi](https://www.pypi.org/project/1337x)\n ```bash\n pip install 1337x\n ```\n\n- Install from the source\n ```bash\n git clone https://github.com/hemantapkh/1337x && cd 1337x && python setup.py sdist && pip install dist/*\n ```\n\n## Start guide\n\n### Quick Examples\n\n#### 1. Searching torrents\n```python\n>>> from py1337x import py1337x\n\n# Using 1337x.tw and saving the cache in sqlite database which expires after 500 seconds\n>>> torrents = py1337x(proxy='1337x.to', cache='py1337xCache', cacheTime=500)\n\n>>> torrents.search('harry potter')\n{'items': [...], 'currentPage': 1, 'itemCount': 20, 'pageCount': 50}\n\n# Searching harry potter in category movies and sort by seeders in descending order\n>>> torrents.search('harry potter', category='movies', sortBy='seeders', order='desc') \n{'items': [...], 'currentPage': 1, 'itemCount': 40, 'pageCount': 50}\n\n# Viewing the 5th page of the result\n>>> torrents.search('harry potter', page=5) \n{'items': [...], 'currentPage': , 'itemCount': 20, 'pageCount': 50}\n```\n\n#### 2. Getting Trending Torrents\n\n```python\n>>> from py1337x import py1337x\n\n# Using the default proxy (1337x.to) Without using cache\n>>> torrents = py1337x() \n\n# Today's trending torrents of all category\n>>> torrents.trending() \n{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}\n\n# Trending torrents this week of all category\n>>> torrents.trending(week=True) \n{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}\n\n# Todays trending anime \n>>> torrents.trending(category='anime') \n{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}\n\n# Trending anime this week\n>>> torrents.trending(category='anime', week=True) \n{'items': [...], 'currentPage': 1, 'itemCount': 50, 'pageCount': 1}\n```\n\n#### 3. Getting information of a torrent\n```python\n\n>>> from py1337x import py1337x\n\n# Using 11337x.st and passing the cookie since 11337x.st is cloudflare protected\n>>> torrents = py1337x('11337x.st', cookie='<cookie>')\n\n# Getting the information of a torrent by its link\n>>> torrents.info(link='https://www.1337xx.to/torrent/258188/h9/') \n{'name': 'Harry Potter and the Half-Blood Prince', 'shortName': 'Harry Potter', 'description': \"....\", 'category': 'Movies', 'type': 'HD', 'genre': ['Adventure', 'Fantasy', 'Family'], 'language': 'English', 'size': '3.0 GB', 'thumbnail': '...', 'images': [...], 'uploader': ' ...', 'uploaderLink': '...', 'downloads': '5310', 'lastChecked': '44 seconds ago', 'uploadDate': '4 years ago', 'seeders': '36', 'leechers': '3', 'magnetLink': '...', 'infoHash': '...'}\n\n# Getting the information of a torrent by its link\n>>> torrents.info(torrentId='258188') \n{'name': 'Harry Potter and the Half-Blood Prince', 'shortName': 'Harry Potter', 'description': \"....\", 'category': 'Movies', 'type': 'HD', 'genre': ['Adventure', 'Fantasy', 'Family'], 'language': 'English', 'size': '3.0 GB', 'thumbnail': '...', 'images': [...], 'uploader': ' ...', 'uploaderLink': '...', 'downloads': '5310', 'lastChecked': '44 seconds ago', 'uploadDate': '4 years ago', 'seeders': '36', 'leechers': '3', 'magnetLink': '...', 'infoHash': '...'}\n```\n\n## Detailed documentation\n\n## Available attributes\n\n```python\nfrom py1337x import py1337x\n\ntorrents = py1337x(proxy='1337x.st', cookie='<cookie>', cache='py1337xCache', cacheTime=86400, backend='sqlite')\n```\n\n**Proxy**\n\nIf the default domain is banned in your country, you can use an alternative domain of 1337x. \n\n- [`1337x.to`](https://1337x.to) (**default**)\n- [`1337x.st`](https://1337x.st)\n- [`x1337x.ws`](https://x1337x.ws)\n- [`x1337x.eu`](https://x1337x.eu)\n- [`x1337x.se`](https://x1337x.se)\n- [`1337x.so`](https://1337x.so)\n- [`1377x.to`](https://www.1377x.to) (unofficial)\n- [`1337xx.to`](https://www.1337xx.to) (unofficial)\n\n**cookie**\n\nSome of the proxies are protected with Cloudflare. For such proxies you need to pass a cookie value. To get a cookie go the the protected site from your browser, solve the captcha and copy the value of `cf_clearance`.\n\n``Firefox: Inspect element > Storage > Cookies`` <br>\n``Chrome: Inspect element > Application > Storage > Cookies``\n\n**cache** \n\nPy1337x uses [requests-cache](https://pypi.org/project/requests-cache/) for caching to store data so that future requests for that data can be served faster. `cache` can be any of the following.\n\n- A boolean value: `True` for using cache and `False` for not using cache. (**cache is not used by default**)\n- Directory for storing the cache.\n\n**cacheTime**\n\nBy default the cache expires after one day. You can change the cache expiration time by setting a custom `cacheTime`. \n\n- `-1` (to never expire)\n\n- `0` (to \u201cexpire immediately,\u201d e.g. bypass the cache)\n\n- A positive number (in seconds [**defaults to 86400**])\n\n- A [`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta)\n\n- A [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime)\n\n**backend**\n\nThe backend for storing the cache can be any of the following.\n\n- `'sqlite'`: SQLite database (**default**)\n\n- `'redis'`: Redis cache (`requires redis`)\n\n- `'mongodb'`: MongoDB database (`requires pymongo`)\n\n- `'gridfs'`: GridFS collections on a MongoDB database (`requires pymongo`)\n\n- `'dynamodb'`: Amazon DynamoDB database (`requires boto3`)\n\n- `'memory'`: A non-persistent cache that just stores responses in memory\n\n## Available methods\n\n```python\nfrom py1337x import py1337x\n\ntorrents = py1337x()\n```\n\n Method | Description | Arguments \n----------|-------------|-----------\ntorrents.search(query) | Search for torrents | self,<br>query: `Keyword to search for`,<br>page (Defaults to 1): `Page to view`,<br>category (optional): [category](#available-categories),<br>sortBy (optional): [Sort by](#available-sorting-methods),<br>Order (optional): [order](#available-sorting-order)\ntorrents.trending() | Get trending torrents | self,<br>category (optional): [category](#available-categories),<br>week (Defaults to False): `True for weekely, False for daily`\ntorrents.top() | Get top torrents | self,<br>category (optional): [category](#available-categories)\ntorrents.popular(category) | Get popular torrents | self,<br>category: [category](#available-categories),<br>week (Defaults to False): `True for weekely, False for daily`\ntorrents.browse(category) | Browse browse of certain category | self,<br>category: [category](#available-categories),<br>page (Defaults to 1): `Page to view`\ntorrents.info(link or torrentId) | Get information of a torrent | self,<br>link: `Link of a torrent` or<br>torrentId: `ID of a torrent`\n\n### Available categories\n\n - `'movies'`\n - `'tv'`\n - `'games'`\n - `'music'`\n - `'apps'`\n - `'anime'`\n - `'documentaries'`\n - `'xxx'`\n - `'others'`\n\n### Available sorting methods\n\n- `'time'`\n- `'size'`\n- `'seeders'`\n- `'leechers'`\n\n### Available sorting order\n\n- `'desc'` (for descending order)\n- `'asc'` (for ascending order)\n\n## Contributing\n\nAny contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\n*Thanks to every [contributors](https://github.com/hemantapkh/1337x/graphs/contributors) who have contributed in this project.*\n\n## Projects using this API\n\n* [Torrent Hunt](https://github.com/hemantapkh/torrenthunt) - Telegram bot to search torrents.\n\nWant to list your project here? Just make a pull request.\n## License\n\nDistributed under the MIT License. See [LICENSE](https://github.com/hemantapkh/1337x/blob/main/LICENSE) for more information.\n\n-----\nAuthor/Maintainer: [Hemanta Pokharel](https://github.com/hemantapkh/) | Youtube: [@H9Youtube](https://youtube.com/h9youtube)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Unofficial API of 1337x.to",
"version": "1.2.6",
"project_urls": {
"Documentation": "https://github.com/hemantapkh/1337x/blob/main/README.md",
"Homepage": "https://github.com/hemantapkh/1337x",
"Issue tracker": "https://github.com/hemantapkh/1337x/issues",
"Repository": "https://github.com/hemantapkh/1337x"
},
"split_keywords": [
"1337x",
" torrents"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3d6b0d500ea40a99cb60f6966bb55ad09276cf9320f0396aa2df604cd6dab47c",
"md5": "dcbd622573fb9bf2a1e15f8a8002a516",
"sha256": "89932037251fcf7a67adc0db2ebe380b1d7dbd5204e51856804e1346c5482f25"
},
"downloads": -1,
"filename": "1337x-1.2.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dcbd622573fb9bf2a1e15f8a8002a516",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 8098,
"upload_time": "2024-07-15T16:12:55",
"upload_time_iso_8601": "2024-07-15T16:12:55.237434Z",
"url": "https://files.pythonhosted.org/packages/3d/6b/0d500ea40a99cb60f6966bb55ad09276cf9320f0396aa2df604cd6dab47c/1337x-1.2.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a86b9237d0bd8bdd98c3e1206e5a149fd916b0d7a8216bf9c11f43ee402ee37e",
"md5": "cad463d4d813c5bdb744e8a6b4ec3974",
"sha256": "3f71e1c6b00e0979e0f4bc74e3e41a5fc717407ab79c521b2694aca76daea2b6"
},
"downloads": -1,
"filename": "1337x-1.2.6.tar.gz",
"has_sig": false,
"md5_digest": "cad463d4d813c5bdb744e8a6b4ec3974",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 7182,
"upload_time": "2024-07-15T16:12:56",
"upload_time_iso_8601": "2024-07-15T16:12:56.618492Z",
"url": "https://files.pythonhosted.org/packages/a8/6b/9237d0bd8bdd98c3e1206e5a149fd916b0d7a8216bf9c11f43ee402ee37e/1337x-1.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-15 16:12:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hemantapkh",
"github_project": "1337x",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "1337x"
}