npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thepiratebayapi

v1.1.1

Published

TPB Search API

Downloads

22

Readme

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