✖️ 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 pypi package that helps in generating discord bots.

A pypi package that helps in generating discord bots.

KlevrHQ 3 Nov 17, 2021
The most Advanced yet simple Multi Cloud tool to transfer Your Data from any cloud to any cloud remotely based on Rclone.⚡

Multi Cloud Transfer (Advanced!) 🔥 1.Setup and Start using Rclone on Google Colab and Create/Edit/View and delete your Rclone config file and keep th

Dr.Caduceus 162 Jan 08, 2023
Aria/qBittorrent Telegram mirror/leech bot.

Missneha Mirror Leech Bot Aria/qBittorrent Telegram mirror/leech bot. missneha Mirror Leech Bot is a multipurpose Telegram Bot written in Python for m

ACHAL 6 Sep 30, 2022
Bot for mirroring one or multiple Twitter accounts in Pleroma/Mastodon.

Stork (pleroma-bot) Mirror one or multiple Twitter accounts in Pleroma/Mastodon. Introduction After using the pretty cool mastodon-bot for a while, I

73 Jan 08, 2023
Cities bot - A simple example of using aiogram and the wikipedia package

Cities game A simple example of using aiogram and the wikipedia package. The bot

Artem Meller 2 Jan 29, 2022
DB-Drive-CSV - This is app is can be used to access CSV file as JSON from Google Drive.

DB Drive CSV This is app is can be used to access CSV file as JSON from Google Drive. How To Use Create file/ upload file to Google Drive There's 2 fi

Hartawan Bahari M. 5 Oct 20, 2022
A link shortner telegram bot version 2 with advanced features

URL-Shortner-Bot-V2 A link shortner telegram bot version 2 with advanced features Made with Python3 (C) @FayasNoushad Copyright permission under MIT L

Fayas Noushad 18 Dec 29, 2022
🖥️ Python - P1 Monitor API Asynchronous Python Client

🖥️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 9 Dec 12, 2022
Código que verifica se o grafo é Hamiltoniano (Em Python)

Código para encontrar um ciclo de Hamilton em um dado grafo e a partir daí verificar se o grafo é hamiltoniano. Um ciclo hamiltoniano é um ciclo gerad

Hemili Beatriz 1 Jan 08, 2022
This is a python wrapper for "the best api in the world"

This is a python wrapper for my api api_url = "https://api.dhravya.me/" This wrapper now has async support, its basically the same except it uses asyn

Dhravya Shah 3 Dec 21, 2021
API Wrapper for seedr.cc

Seedr Python Client Seedr API built with 💛 by Souvik Pratiher Hit that Star button if you like this kind of SDKs and wants more of similar SDKs for o

Souvik Pratiher 2 Oct 24, 2021
Track player's stats, find out when they're online and grinding!

Hypixel Stats Tracker Track player's stats, find out when they're online and playing games! INFO Showcase Server: https://discord.gg/yY5qQHPar6 Suppor

4 Dec 18, 2022
The Official Dropbox API V2 SDK for Python

The offical Dropbox SDK for Python. Documentation can be found on Read The Docs. Installation Create an app via the Developer Console. Install via pip

Dropbox 828 Jan 05, 2023
A Python library for loading data from a SpaceX Starlink satellite.

Starlink Python A Python library for loading data from a SpaceX Starlink satellite. The goal is to be a simple interface for Starlink. It builds upon

Austin 2 Jan 16, 2022
HackerNews and Reddit in one placce

EDIT: this project is 3.5 years old. I found it sad it's just laying around, so I did some minimal fixes and deployed it. Hope you enjoy! (PR's welcom

Hugo Montenegro 1 Nov 13, 2021
Telegram group manager moderen and simple.

Upin Robot A Advanced Powerful, Smart And Intelligent Group Management Bot With New And Powerful Features ... Written with Pyrogram and Telethon... If

Muhammad Nawawi 3 Dec 23, 2021
A Characther powerful in saints saiya anime and modular telegram group management bot built using python3

Kaneki Ken A Powerful and Modular Saint Aries is a Characther powerful in saints saiya anime and modular telegram group management bot built using pyt

1 Dec 21, 2021
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
Yet another random discord bot.

YARDB (r!) Yet another fully functional and random discord bot. I might add more features if I'm bored also don't criticize on my code. Commands: 4 Di

kayle 1 Oct 21, 2021
AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications

AWS Serverless Application Model (AWS SAM) The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications

Amazon Web Services 8.9k Dec 31, 2022