✖️ Unofficial API of 1337x.to

Overview

✖️ Unofficial Python API Wrapper of 1337x

1337x

Stars Issues

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 and supports sorting too.

Table of Contents

Installation

  • Install via PyPi

    pip install 1337x
  • Install from the source

    git clone https://github.com/hemantapkh/1337x && cd 1337x && python setup.py sdist && pip install dist/*

Start guide

Quick Examples

1. Searching torrents

>>> from py1337x import py1337x

# Using 1337x.tw
>>> torrents = py1337x(proxy='1337x.tw')

>>> 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

>>> from py1337x import py1337x

# Using default proxy (1337xx.to)
>>> torrents = py1337x(proxy=None) 

# 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

>>> from py1337x import py1337x

>>> torrents = py1337x()

# 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', 'image': '...', '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', 'image': '...', 'uploader': ' ...', 'uploaderLink': '...', 'downloads': '5310', 'lastChecked': '44 seconds ago', 'uploadDate': '4 years ago', 'seeders': '36', 'leechers': '3', 'magnetLink': '...', 'infoHash': '...'}

Detailed documentation

Available methods

from py1337x import py1337x

torrents = py1337x()
Method Description Arguments
torrents.search(query) Search for torrents self,
query: Keyword to search for,
page (Defaults to 1): Page to view,
category (optional): category,
sortBy (optional): Sort by,
Order (optional): order
torrents.trending() Get trending torrents self,
category (optional): category,
week (Defaults to False): True for weekely, False for daily
torrents.top() Get top torrents self,
category (optional): category
torrents.popular(category) Get popular torrents self,
category: category,
week (Defaults to False): True for weekely, False for daily
torrents.browse(category) Browse browse of certain category self,
category: category,
page (Defaults to 1): Page to view
torrents.info(link or torrentId) Get information of a torrent self,
link: Link of a torrent or
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 who have contributed in this project.

Projects using this API

Want to list your project here? Just make a pull request.

License

Distributed under the MIT License. See LICENSE for more information.


Author/Maintainer: Hemanta Pokharel | Youtube: @H9Youtube

Comments
  • KeyError when parsing for torrent information

    KeyError when parsing for torrent information

    Hi there,

    I've been trying to debug this and it looks like there is a KeyError thrown when trying to access the information for certain torrents.

    I'm trying to grab the info on a torrent via this: info = torrents.info(torrentId=897966)

    and I get the following error. It doesnt happen on all torrents though only some.

      File "/Users/test.py", line 41, in download_from_1337x
        info = torrents.info(torrentId=897966)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/py1337x.py", line 70, in info
        return parser.infoParser(response, baseUrl=self.baseUrl)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/parser.py", line 67, in infoParser
        images = [i['data-original'] for i in images.find_all('img')] if images else None
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/parser.py", line 67, in <listcomp>
        images = [i['data-original'] for i in images.find_all('img')] if images else None
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bs4/element.py", line 1406, in __getitem__
        return self.attrs[key]
    KeyError: 'data-original' 
    
    opened by bazmattaz 4
  • No module named Py1337x after update

    No module named Py1337x after update

    Hi,

    I just pulled the latest the latest update of this repo and am now getting the following error when trying to import py1337x (like your readme file says).

    Here is the output of my python interpreter:

    Python 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) 
    [Clang 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from py1337x import py1337x
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/__init__.py", line 1, in <module>
        from Py1337x.Py1337x import Py1337x
    ModuleNotFoundError: No module named 'Py1337x' 
    
    opened by bazmattaz 3
  • Excluding base url prefix to cdn thumbnails

    Excluding base url prefix to cdn thumbnails

    Before: The 'base-URL' will be the prefix of the thumbnail's URL if it does not start with "HTTP".

    Issue Many thumbnails are served from CDNs (URLs starting with "//") and thus will not require "1337x.to" as the base URL.

    Fix URLs starting with "HTTP" and "//" i.e CDN URLs will be discarded from any base URL addition process.

    Sample URL: https://1337x.to/torrent/5464180/Black-Adam-2022-FullHD-1080p-H264-Ita-Eng-AC3-5-1-Sub-Ita-Eng-realDMDJ-DDL_Ita/

    opened by itsmehemant7 1
  • Examples with 1337x.tw are not working

    Examples with 1337x.tw are not working

    torrents = py1337x(proxy='1337x.tw', cache='py1337xCache', cacheTime=500)

    the examples on the readme here and on the pypi page are not working, should change to 1337x.to, which does work

    opened by arye321 1
  • Module raises TypeError

    Module raises TypeError

    The minimal example

    `from py1337x import py1337x

    torrents = py1337x()

    print(torrents.search("harry potter"))`

    raises the error

    File "/home/pako/.local/lib/python3.10/site-packages/py1337x/init.py", line 1, in from py1337x.py1337x import py1337x File "/home/pako/.local/lib/python3.10/site-packages/py1337x/py1337x.py", line 2, in import requests_cache File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/init.py", line 43, in from .backends import * File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/backends/init.py", line 8, in from .base import BaseCache, BaseStorage File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/backends/base.py", line 18, in from ..serializers import init_serializer File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/serializers/init.py", line 6, in from .preconf import ( File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/serializers/preconf.py", line 26, in base_stage = CattrStage() #: Base stage for all serializer pipelines File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/serializers/cattrs.py", line 32, in init self.converter = init_converter(factory) File "/home/pako/.local/lib/python3.10/site-packages/requests_cache/serializers/cattrs.py", line 67, in init_converter converter.register_structure_hook( File "/home/pako/.local/lib/python3.10/site-packages/cattr/converters.py", line 269, in register_structure_hook self._structure_func.register_cls_list([(cl, func)]) File "/home/pako/.local/lib/python3.10/site-packages/cattr/dispatch.py", line 57, in register_cls_list self._single_dispatch.register(cls, handler) File "/usr/lib/python3.10/functools.py", line 856, in register raise TypeError( TypeError: Invalid first argument to register(). ForwardRef('CachedResponse') is not a class.

    Python version is 3.10.2

    opened by pako-github 1
  • Feature Request ( Use a torrent aggregator )

    Feature Request ( Use a torrent aggregator )

    Hello I think it would be a great idea if you use a torrent aggregator site like - https://snowfl.com to do the scrapping instead of 1337x . So each query will display the combined results from all torrent sites which will be very convenient. Unfortunately if this is beyond the scope of this project , then you can close this issue

    opened by xd003 1
  • it is not working at all

    it is not working at all

    OS: ArcoLinux Python Version: 3.10.4

    it is not working, i tried sqlite and mongodb, they all throw errors what am i missing?

    sqlite:

    mongodb: "pymongo is installed"

    p.s.: nevermind the different url passed to the info function, even i it is 1337x.to it still gives the same errors

    opened by AbdelrhmanNile 2
Releases(v1.2.4)
Owner
Hemanta Pokharel
V293IDMxMzM3IHNpciwgWW91IGdvdCBpdDogaHR0cHM6Ly9iaXQubHkvM2xsQ1ZIZg==
Hemanta Pokharel
A basic Ubisoft API wrapper created in python.

UbisoftAPI A basic Ubisoft API wrapper created in python. I will be updating this with more endpoints as time goes on. Please note that this is my fir

Ethan 2 Oct 31, 2021
Create Multiple CF entry for multiple websites

AWS-CloudFront Problem: Deploy multiple CloudFront for account with multiple domains. Functionality: Running this script in loop and deploy CloudFront

Giten Mitra 5 Nov 18, 2022
A simple bot to upload file to various cloud servers.

Cloudsy Bot A simple bot to upload file to various cloud servers. Variables API_HASH Your API Hash from my.telegram.org API_ID Your API ID from my.tel

Flying Santas 8 Oct 31, 2022
Using AWS Batch jobs to bulk copy/sync files in S3

Using AWS Batch jobs to bulk copy/sync files in S3

AWS Samples 14 Sep 19, 2022
✨ Music&Video Userbot

🎶 Fizi - UserBot 🎶 🤖 Telegram UserBot Untuk Memutar Lagu Dan Video Di Obrolan Suara Telegram. ✨ Didukung Oleh PyTgCalls Pyrogram 📝 Persyaratan Pyt

F I Z I • Ɱeƙípres 4 Mar 29, 2022
Blankly - 🚀 💸 Trade stocks, cryptos, and forex w/ one package. Easily build, backtest, trade, and deploy across exchanges in a few lines of code.

💨 Rapidly build and deploy quantitative models for stocks, crypto, and forex 🚀 View Docs · Our Website · Join Our Newsletter · Getting Started Why B

Blankly Finance 1.4k Jan 03, 2023
Ridogram is an advanced multi-featured Telegram UserBot.

Ridogram Ridogram is an advanced multi-featured Telegram UserBot. String Session Collect String Session by running python3 stringsession.py locally or

Md. Ridwanul Islam Muntakim 134 Dec 29, 2022
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

16 Oct 21, 2022
A telegram bot providing recon and research functions for bug bounty research

Bug Bounty Bot A telegram bot with commands to simplify bug bounty tasks Installation Use Road Map Installation BugBountyBot is open-source so you can

Tyler Butler 1 Oct 23, 2021
A stack-based systems language that supports structures, functions, expressions, and user-defined operator behaviour

A stack-based systems language that supports structures, functions, expressions, and user-defined operator behaviour. Currently compiles to URCL with plans to add additional formats in the future.

Lucida Dragon 3 Nov 03, 2022
Yandex OSINT tool

YaSeeker Description YaSeeker - an OSINT tool to get info about any Yandex account using email or login. It can find: Fullname Photo Gender Yandex UID

HowToFind 110 Jan 03, 2023
Prometheus exporter for CNMC API

CNMC Prometheus exporter It needs a Prometheus Pushgateway Install requirements via pip install -r requirements.txt Export the following environment v

GISCE-TI 1 Oct 20, 2021
Connect your Nintendo Switch playing status to Discord!

Disclaimer: Unfortunately, it appears that Nintendo has removed returning self-Presence in their API as of recently, making this project near obsolete

Deltaion Lee 145 Dec 30, 2022
Twitter bot code can be found in twitterBotAPI.py

NN Twitter Bot This github repository is BASED and is yanderedev levels of spaghetti Neural net code can be found in alexnet.py. Despite the name, it

167 Dec 19, 2022
Terminal-Trade(Panel API) For Binance

Binance-Trade-Project Binance Futures Terminal-Trade(API) & Binance This Project Worth Around 500 Bucks. **I Did This Project For SomeOne And He

Cyber 9 Dec 30, 2021
SpautiNoFay - A simple and beautiful music player created with Python

SpautiNoFay A simple and beautiful music player created with Python Why SpautiNo

8 Jan 19, 2022
Get-Phone-Number-Details-using-Python - To get the details of any number, we can use an amazing Python module known as phonenumbers.

Get-Phone-Number-Details-using-Python To get the details of any number, we can use an amazing Python module known as phonenumbers. We can use the amaz

Coding Taggers 1 Jan 01, 2022
HinamiRobot - Telegram Group Manager Bot Written In Python Using Pyrogram

✨ HINAMI CHAN ✨ Telegram Group Manager Bot Written In Python Using Pyrogram. Rea

DARK LEGEND088 2 Jan 27, 2022
This bot will pull a stream of tweets based on rules you set and automatically reply to them.

Twitter reply bot This bot will pull a stream of tweets based on rules you set and automatically reply to them. I built this bot in order to help comb

Brains 1 Feb 13, 2022
Scheduled Block Checker for Cardano Stakepool Operators

ScheduledBlocks Scheduled Block Checker for Cardano Stakepool Operators Lightweight and Portable Scheduled Blocks Checker for Current Epoch. No cardan

SNAKE (Cardano Stakepool) 4 Oct 18, 2022