{"id":18780384,"url":"https://github.com/karan/tpb","last_synced_at":"2025-12-13T18:25:21.632Z","repository":{"id":10377768,"uuid":"12522891","full_name":"karan/TPB","owner":"karan","description":":cloud: Python API for ThePirateBay.","archived":false,"fork":false,"pushed_at":"2020-03-27T18:12:06.000Z","size":1041,"stargazers_count":331,"open_issues_count":15,"forks_count":65,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-02-12T07:10:57.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-01T15:54:54.000Z","updated_at":"2024-06-12T15:45:08.000Z","dependencies_parsed_at":"2022-09-12T21:01:07.321Z","dependency_job_id":null,"html_url":"https://github.com/karan/TPB","commit_stats":null,"previous_names":["thekarangoel/tpb"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2FTPB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2FTPB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2FTPB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karan%2FTPB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karan","download_url":"https://codeload.github.com/karan/TPB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239695839,"owners_count":19682126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T20:26:12.453Z","updated_at":"2025-12-13T18:25:21.585Z","avatar_url":"https://github.com/karan.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"![TPB](http://www.goel.im/images/tpb.jpg)\n\nUnofficial Python API for [ThePirateBay](http://thepiratebay.org/).\n\n| Build Status | Test Coverage | Version | Downloads (30 days) |\n| ------------ | ------------- | ------- | ------------------- |\n| [![Build Status](https://travis-ci.org/karan/TPB.png?branch=master)](https://travis-ci.org/karan/TPB) | [![Coverage Status](https://coveralls.io/repos/karan/TPB/badge.png)](https://coveralls.io/r/karan/TPB) | [![Latest Version](https://pypip.in/v/ThePirateBay/badge.png)](https://pypi.python.org/pypi/ThePirateBay/) | [![Downloads](https://pypip.in/d/ThePirateBay/badge.png)](https://pypi.python.org/pypi/ThePirateBay/) |\n\nInstallation\n=============\n```sh\n$ pip install ThePirateBay\n```\n\nNote that ``ThePirateBay`` depends on ``lxml``. If you run into problems in the compilation of ``lxml`` through ``pip``, install the ``libxml2-dev`` and ``libxslt-dev`` packages on your system.\n\nUsage\n==========\n\n```python\nfrom tpb import TPB\nfrom tpb import CATEGORIES, ORDERS\n\nt = TPB('https://thepiratebay.org') # create a TPB object with default domain\n\n# search for 'public domain' in 'movies' category\nsearch = t.search('public domain', category=CATEGORIES.VIDEO.MOVIES)\n\n# return listings from page 2 of this search\nsearch.page(2)\n\n# sort this search by count of seeders, and return a multipage result\nsearch.order(ORDERS.SEEDERS.ASC).multipage()\n\n# search, order by seeders and return page 3 results\nt.search('python').order(ORDERS.SEEDERS.ASC).page(3)\n\n# multipage beginning on page 4\nt.search('recipe book').page(4).multipage()\n\n# search, in a category and return multipage results\nt.search('something').category(CATEGORIES.OTHER.OTHER).multipage()\n\n# get page 3 of recent torrents\nt.recent().page(3)\n\n# get top torrents in Movies category\nt.top().category(CATEGORIES.VIDEO.MOVIES)\n\n# print all torrent descriptions\nfor torrent in t.search('public domain'):\n    print(torrent.info)\n\n# print all torrent files and their sizes\nfor torrent in t.search('public domain'):\n    print(torrent.files)\n```\n\nTorrent details available\n==================\n\nAttributes\n----------\n\n* **title** # the title of the torrent\n* **url** # TPB url for the torrent\n* **category** # the main category\n* **sub_category** # the sub category\n* **magnet_link** # magnet download link\n* **torrent_link** # .torrent download link\n* **created** # uploaded date time\n* **size** # size of torrent\n* **user** # username of uploader\n* **seeders** # number of seeders\n* **leechers** # number of leechers\n\nProperties\n----------\n\n* **created** # creation date -- parsed when accessed\n* **info** # detailed torrent description -- *needs separate request*\n* **files** # dictionary of files and their size -- *needs separate request*\n\nTests\n=====\n\nTests can be ran using `tox`.\n```sh\n$ pip install tox\n$ tox\n```\n\nAlternatively, you will need to install dependencies manually:\n```sh\n$ pip install -r tests/requirements.txt\n```\n\nThen, to execute the tests simply run:\n```sh\n$ python -m unittest discover\n```\n\nBy default the tests are ran on a local test server with predownloaded original\nresponses. You can activate the remote running option by:\n```sh\n$ REMOTE=true python -m unittest discover\n```\n\nDonations\n========\n\nIf *TPB* has helped you in any way, and you'd like to help the developer, please consider donating.\n\n**- BTC: [19dLDL4ax7xRmMiGDAbkizh6WA6Yei2zP5](http://i.imgur.com/bAQgKLN.png)**\n\n**- Gratipay: [https://www.gratipay.com/karan/](https://www.gittip.com/karan/)**\n\n**- Flattr: [https://flattr.com/profile/thekarangoel](https://flattr.com/profile/thekarangoel)**\n\nContribute\n========\n\nIf you want to add any new features, or improve existing ones, feel free to send a pull request!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran%2Ftpb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaran%2Ftpb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaran%2Ftpb/lists"}