✖️ 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 discord token creator that uses the service capmonster for captcha solving!

Discord Token Creator A discord token creator that uses the service capmonster for captcha solving! Report Bug · Request Feature Features Autojoin dis

dropout 41 Oct 25, 2021
PyMed is a Python library that provides access to PubMed.

IMPORTANT NOTE: I don't have time to maintain this library (as some of you might have noticed). The PubMed API is a little chaotic, without a clear do

Gijs Wobben 143 Dec 21, 2022
Univerity-student oriented (lithuanian) discord bot

Univerity-student oriented (lithuanian) discord bot

3 Nov 30, 2021
D-Ticket is a discord bot for ticket system

D-Ticket Discord Bot D-Ticket is a discord bot for ticket management system. This is not final product is currently being in development stay connecte

DeViL 1 Jan 06, 2022
Microsoft Azure Storage Library for Python

Microsoft Azure Storage Library for Python

Microsoft Azure 329 Dec 16, 2022
Some random bot for Discord which was created just for fun (Made with Discord.py library)

Ghosty Previously known as 'secondthunder-py-bot' This is repository of some random bot for Discord which was created just for fun and for some educat

Владислав 8 Oct 02, 2022
Telegram üzerinden paylaşılan kısa linkleri geçmenin daha hızlı bir yolu

Telegram Url skipper Telegramda paylaşılan kısa linkleri geçmenin daha hızlı bir yolu · Hata Raporla · Öneri Yap İçerik Tablosu Kurulum Kullanım Lisan

WarForPeace 6 Oct 07, 2022
Web3 Pancakeswap Sniper & honeypot detector Take Profit/StopLose bot written in python3, For ANDROID WIN MAC & LINUX

Pancakeswap BSC Sniper Bot web3 with honeypot detector (ANDROID WINDOWS MAC LINUX) First SNIPER BOT for ANDROID with honeypot detector Web3 Pancakeswa

HYDRA 1 Dec 23, 2021
Tools untuk krek akun igeh :v

Instalasi pkg update && pkg upgrade -y pkg install python git -y rm -rf InstaCrack git clone https://github.com/AngCyber/InstaCrack pip install reques

Moch Aang Ardiansyah-XD 12 Apr 05, 2022
Eclipse-grabber - Generate Discord Token Grabbers for both Windows and MacOS

Eclipse Grabber Eclipse Discord Token Grabber What is Eclipse? Eclipse is an ope

Dimitris Kalopisis 117 Dec 23, 2022
all-in-one wrapper for NASA API's

=========== About bowshock is an all-in-one wrapper for NASA API's. Here is a list of currently supported API's : NASA Earth API NASA APOD (Astronomy

Emir Ozer 85 Nov 09, 2022
A simple telegram bot that takes a list of files sent by the user and returns them 7zipped

A simple telegram bot that takes a list of files sent by the user and returns them 7zipped

1 Oct 28, 2022
Discord Rpc With Python And 2 Buttons

Discord-RPC-With-Python- Discord Rpc With Python And 2 Buttons Packages pypresence time Required Programs Python Latest Version Random IDE Discord :P

Kaz 4 Dec 12, 2021
Role Based Access Control for Slack-Bolt Applications

Role Based Access Control for Slack-Bolt Apps Role Based Access Control (RBAC) is a term applied to limiting the authorization for a specific operatio

Jeremy Schulman 7 Jan 06, 2022
A GUI Application that creates a Spotify Playlist from any year in the past, by just entering your preferred date

A GUI Application that creates a Spotify Playlist from any year in the past, by just entering your preferred date

David .K. Danso 1 Jan 17, 2022
A unified API wrapper for YouTube and Twitch chat bots.

Chatto A unified API wrapper for YouTube and Twitch chat bots. Contributing Chatto is open to contributions. To find out where to get started, have a

Ethan Henderson 5 Aug 01, 2022
Dynamic Twitter banner, to show off your spotify status. Banner updated every 5 minutes.

Spotify Twitter Banner Dynamic Twitter banner, to show off your spotify status. Banner updated every 5 minutes. Installation and Usage Install the dep

Sunrit Jana 23 Jan 05, 2023
Flask-SQLAlchemy API for daisuki-web

💟 Anime Daisuki! API API de animes com cadastro de usuários. O usuário autenticado pode avaliar e favoritar animes, comentar episódios e verificar o

Paulo Thor 1 Nov 04, 2021
Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker.

Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker. Unlimited RajeLiker Credit Hack. Thanks To RajeLiker.

Md. Mehedi Hasan 32 Dec 28, 2022
Simple discord token generator good for memberboosting your server! Uses Hcaptcha bypass

discord-tokens-generator INFO This is a Simple Discord Token Generator which creates unverified discord accounts These accounts are good for member bo

Avenger 41 Dec 20, 2022