GithubHelp home page GithubHelp logo

tpb's Introduction

TPB

Unofficial Python API for ThePirateBay.

Build Status Coverage Status Version Downloads

Installation

$ pip install ThePirateBay

Donate

If you love and use TPB, please consider donating via gittip. Any support is appreciated!

Usage

from tpb import TPB
from tpb import CATEGORIES, ORDERS

t = TPB('https://thepiratebay.sx') # create a TPB object with default domain

# search for 'breaking bad' in 'movies' category
search = t.search('breaking bad', category=CATEGORIES.VIDEO.MOVIES)

# return listings from page 2 of this search
search.page(2)

# sort this search by count of seeders, and return a multipage result
search.order(ORDERS.SEEDERS.ASC).multipage()

# search, order by seeders and return page 3 results
t.search('breaking bad').order(ORDERS.SEEDERS.ASC).page(3)

# multipage beginning on page 4
t.search('babylon 5').page(4).multipage()

# search, in a category and return multipage results
t.search('something').category(CATEGORIES.OTHER.OTHER).multipage()

# get page 3 of recent torrents
t.recent().page(3)

# get top torrents in Movies category
t.top().category(CATEGORIES.VIDEO.MOVIES)

Torrent details available

  • title # the title of the torrent
  • url # TPB url for the torrent
  • category # the main category
  • sub_category # the sub category
  • magnet_link # magnet download link
  • torrent_link # .torrent download link
  • created # uploaded date time
  • size # size of torrent
  • user # username of uploader
  • seeders # number of seeders
  • leechers # number of leechers

Tests

You need bottle and testscenarios installed to run the tests.

$ pip install -r tests/requirements.txt

To execute the tests simply run:

$ python -m unittest discover

Every test is executed twice, once on a local test server with predownloaded original responses and, if it's possible, an other time on the original remote server.

To deactivate the execution or local or remote tests:

$ REMOTE=false python -m unittest discover
$ LOCAL=false python -m unittest discover

Contribute

If you want to add any new features, or improve existing ones, feel free to send a pull request!

tpb's People

Contributors

amney avatar cjil avatar granda avatar jaormx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.