✖️ 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
An API wrapper for Henrik's Unofficial VALORANT API

ValorantAPI.py An API wrapper for Henrik's Unofficial VALORANT API Warning!! This project is still in beta and only contains barely anything yet. If y

Jakkaphat Chalermphanaphan 0 Feb 4, 2022
This package accesses nitrotype's official api along with its unofficial user api

NitrotypePy This package accesses nitrotype's official api along with its unofficial user api. Currently still in development. Install To install, run

The Moon That Rises 2 Sep 4, 2022
The unofficial Amazon search CLI & Python API

amzSear The unofficial Amazon Product CLI & API. Easily search the amazon product directory from the command line without the need for an Amazon API k

Asher Silvers 95 Nov 11, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 204 Dec 28, 2022
Unofficial GoPro API Library for Python - connect to GoPro via WiFi.

GoPro API for Python Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. Compatibility: HERO3 HERO3+ HERO4 (including HERO Se

Konrad Iturbe 1.3k Jan 1, 2023
Unofficial Python wrapper for official Hacker News API

haxor Unofficial Python wrapper for official Hacker News API. Installation pip install haxor Usage Import and initialization: from hackernews import H

null 147 Sep 18, 2022
Unofficial Medium Python Flask API and SDK

PyMedium - Unofficial Medium API PyMedium is an unofficial Medium API written in python flask. It provides developers to access to user, post list and

Engine Bai 157 Nov 11, 2022
(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.

Googletrans Googletrans is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make

Suhun Han 3.2k Jan 4, 2023
Unofficial Python API client for Notion.so

notion-py Unofficial Python 3 client for Notion.so API v3. Object-oriented interface (mapping database tables to Python classes/attributes) Automatic

Jamie Alexandre 3.9k Jan 3, 2023
An Unofficial TikTok API Wrapper In Python

This is an unofficial api wrapper for TikTok.com in python. With this api you are able to call most trending and fetch specific user information as well as much more.

David Teather 2.9k Jan 8, 2023
Unofficial YooMoney API python library

API Yoomoney - unofficial python library This is an unofficial YooMoney API python library. Summary Introduction Features Installation Quick start Acc

Aleksey Korshuk 136 Dec 30, 2022
This is a simple unofficial async Api-wrapper for tio.run

Async-Tio This is a simple unofficial async Api-wrapper for tio.run

Tom-the-Bomb 7 Oct 28, 2022
Unofficial python api for MicroBT Whatsminer ASICs

whatsminer-api Unofficial python api for MicroBT Whatsminer ASICs Code adapted from a python file found in the Whatsminer Telegram group that is credi

Satoshi Anonymoto 16 Dec 23, 2022
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API

TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API, which provides functiona

Tim Dorssers 233 Dec 30, 2022
Unofficial API wrapper for seedr.cc

Seedr API Unofficial API wrapper for seedr.cc Inspired by theabbie's seedr-api Powered by @harp_tech (Telegram) How to use You can install lib via git

Anjana Madu 49 Oct 24, 2022
Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.

Instagram-API-python Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Pyt

Vladimir Bezrukov 1 Nov 19, 2021
An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

DeepLn 2 Jan 5, 2022
Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Ahmet Eren Odacı 9 Nov 6, 2022
Clash of Clans developer unofficial api Wrapper to generate ip based token

Clash of Clans developer unofficial api Wrapper to generate ip based token

Aryan Vikash 6 Apr 1, 2022