thepiratebayapi

    1.1.1 • Public • Published

    alt text

    ThePirateBay API

    TPBAPI is a simple torrent search engine for ThePirateBay.

    Installation

    Use the package manager npm to install.

    npm install thepiratebayapi

    Usage

    const TPBAPI = require('tpbapi')
     
    let tpbapi = new TPBAPI()

    Config

    CORS_bypass If you get errors while fetching torrents
    proxy Use proxies to fetch torrents. You can set it manually or it will fetch proxies for you.
    removeZeroSeedersTorrents Removes all torrents with 0 seeders
    onlyTrusted Removes all torrents for which uploader is not verified
    trackers Current trackers are taken from thepiratebay.org

    tpbapi._config = {
            CORS_bypass: false,
            proxy: {
                enabled: false,
                ip: null,
                port: null
            },
            removeZeroSeedersTorrents: false,
            onlyTrusted: false,
            trackers: [
                'udp://tracker.coppersurfer.tk:6969/announce',
                'udp://9.rarbg.to:2920/announce',
                'udp://tracker.opentrackr.org:1337',
                'udp://tracker.internetwarriors.net:1337/announce',
                'udp://tracker.leechers-paradise.org:6969/announce',
                'udp://tracker.pirateparty.gr:6969/announce',
                'udp://tracker.cyberia.is:6969/announce'
            ]
        }

    Category ID's

    Audio - 100

    Music - 101 | Audio books - 102 | Sound clips - 103 | FLAC - 103 | Other - 199

    Video - 200

    Movies - 101 | Movies DVDR - 102 | Music videos - 103 | Movie clips - 103 | TV Shows - 199 | Handheld - 222 | HD - Movies - 434 | HD - TV shows - 442 | 3D - 424 | Other - 299

    Applications - 300

    Windows - 101 | Mac - 102 | UNIX - 103 | Handheld - 103 | IOS (iPad/iPhone) - 199 | Android - 525 | Other OS - 205

    Games - 400

    PC - 401 | Mac - 402 | PSx - 403 | XBOX360 - 404 | Wii - 405 | Handheld - 406 | IOS(iPad/iPhone) - 407 | Android - 408 | Other - 499

    Other - 600

    E-books - 601 | Comics - 602 | Pictures - 603 | Covers - 604 | Physibles - 605 | Other - 699

    Functions

    search(search value, category ID, callback(torrents)) - Search torrents by string and category

    tpbapi.search('avengers', 200 , (torrents) => {
      console.log(torrents)
    })

    getTopTorrents(category ID, callback(torrents)) - Get Top 100 torrents by category

    //Get top 100 PC Games
    tpbapi.getTopTorrents( 401 , (torrents) => {
      console.log(torrents)
    })

    generateMagnetLink(torrent) - Generate and return magnet link

    //Example
    tpbapi.getTopTorrents( 401 , (torrents) => {
      torrents.forEach(torrent => {
          torrent.magnetUrl = tpbapi.generateMagnetLink(torrent)
      })
    })

    getProxy() - Fetch proxies and store in _config.proxy.proxies. First fetched proxy will automatically be mounted. proxy.ip and proxy.port must be null when manually calling this function. Proxies from Germany and Great Britain are excluded.

    //Example
    tpbapi.getProxy(() => {
        console.table(tpb._config.proxy.proxies)
    })

    In case you have problems with CORS, enable CORS Bypass

    tpbapi.enableCORS_Bypass = true

    License

    MIT © 2020 drkeey

    Install

    npm i thepiratebayapi

    DownloadsWeekly Downloads

    2

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    99.8 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar