Package: 1337x
✖️Unofficial Python API Wrapper of 1337xThis 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.Table of ContentsInstallationStart GuideQuick ExamplesSearching TorrentsGetting Trending TorrentsGetting information of a torrentDetailed DocumentationAvailable attributesAvailable methodsAvailable categoryAvailable sorting methodsContributingProjects using this APILicenseInstallationInstall viaPyPipipinstall1337xInstall from the sourcegitclonehttps://github.com/hemantapkh/1337x&&cd1337x&&pythonsetup.pysdist&&pipinstalldist/*Start guideQuick Examples1. Searching torrents>>>frompy1337ximportpy1337x# Using 1337x.tw and saving the cache in sqlite database which expires after 500 seconds>>>torrents=py1337x(proxy='1337x.tw',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>>>frompy1337ximportpy1337x# 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>>>frompy1337ximportpy1337x# 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 documentationAvailable attributesfrompy1337ximportpy1337xtorrents=py1337x(proxy='1337x.st',cookie='<cookie>',cache='py1337xCache',cacheTime=86400,backend='sqlite')ProxyIf the default domain is banned in your country, you can use an alternative domain of 1337x.1337x.to(default)1337x.tw1377x.to1337xx.to1337x.stx1337x.wsx1337x.eux1337x.se1337x.is1337x.gdcookieSome 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 ofcf_clearance.Firefox: Inspect element > Storage > CookiesChrome: Inspect element > Application > Storage > CookiescachePy1337x usesrequests-cachefor caching to store data so that future requests for that data can be served faster.cachecan be any of the following.A boolean value:Truefor using cache andFalsefor not using cache. (cache is not used by default)Directory for storing the cache.cacheTimeBy default the cache expires after one day. You can change the cache expiration time by setting a customcacheTime.-1(to never expire)0(to “expire immediately,” e.g. bypass the cache)A positive number (in seconds [defaults to 86400])AtimedeltaAdatetimebackendThe 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 memoryAvailable methodsfrompy1337ximportpy1337xtorrents=py1337x()MethodDescriptionArgumentstorrents.search(query)Search for torrentsself,query:Keyword to search for,page (Defaults to 1):Page to view,category (optional):category,sortBy (optional):Sort by,Order (optional):ordertorrents.trending()Get trending torrentsself,category (optional):category,week (Defaults to False):True for weekely, False for dailytorrents.top()Get top torrentsself,category (optional):categorytorrents.popular(category)Get popular torrentsself,category:category,week (Defaults to False):True for weekely, False for dailytorrents.browse(category)Browse browse of certain categoryself,category:category,page (Defaults to 1):Page to viewtorrents.info(link or torrentId)Get information of a torrentself,link:Link of a torrentortorrentId:ID of a torrentAvailable 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)ContributingAny contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestThanks to everycontributorswho have contributed in this project.Projects using this APITorrent Hunt- Telegram bot to search torrents.Want to list your project here? Just make a pull request.LicenseDistributed under the MIT License. SeeLICENSEfor more information.Author/Maintainer:Hemanta Pokharel| Youtube:@H9Youtube