Skip to content

bluecap-se/yarr

Repository files navigation

Yarr!

Circle CI Dependency Status NPM version Docker pulls

I feel lucky, for The Pirate Bay. A micro HTTP service, for picking the best torrent available for download, by searching TPB.

Install

Yarr! can be installed as a package either via NPM or Docker.

Using Docker

$ docker run -d -p 80:8080 bluecap/yarr:latest

Using a package manager

$ npm install yarr

Usage

$ yarr
Server started on localhost:8080

This will start the HTTP server, with default config. Then navigate to localhost:8080

Full options

$ yarr -h

I feel lucky, for The Pirate Bay

Usage:
    yarr [<config>]
    yarr [options]

Options:
    --host=HOST       Set server host
    --port=PORT       Set server port
    --source=URL      Set The Pirate Bay URL
    --api-key=TOKEN   Set API-key
    -h --help         Show this screen
    -v --version      Show version

Examples:
       yarr (run the server with default config)
       yarr ~/config.json
       yarr --host localhost --port 8080

Using Docker

Options can be set as environment variables. Only source and api-key can be set, the rest can be configured by using the port option.

$ docker run -d -p 80:8080 -e API_KEY='secret' -e SOURCE='http://thepiratebay.se' bluecap/yarr:latest

Use case

Getting the best torrent

Here, HTTPie is used when calling the API over HTTP. Using Curl is another option.

$ http localhost:8080/search q==Game s==1 e==5 hd==720p
{
    "name": "...",
    "added": "05-16 2011",
    "magnet": "magnet:?xt=urn:...",
    "size": "1.46 GiB",
    "seeders": "69",
    "leachers": "10"
}

Getting the magnet

Here, jq is used to parse the result from Yarr!. The result can then be piped to a torrent application of your choice.

$ http localhost:8080/search q==Game s==1 e==5 hd==720p | jq .magnet
magnet:?xt=urn:

API

All response is JSON formatted.

Perform a search

Returned is the best matching torrent.

$ http localhost:8080/search q==value [param==value]
Param Required Description Input type
q Yes Search query. Freetext string
s No Season, for shows. Number
e No Episode, for shows. Requires season. Number
hd No Flag for HD. 720p, 1080p

Check version

Returned is the running version of Yarr!

$ http localhost:8080/version
{
    "version": "1.1.0"
}

Run tests

$ make test

License

Published under MIT License.