An open API service indexing awesome lists of open source software.

https://github.com/bluecap-se/yarr

I feel lucky, for The Pirate Bay
https://github.com/bluecap-se/yarr

docker nodejs pirate-bay

Last synced: about 2 months ago
JSON representation

I feel lucky, for The Pirate Bay

Awesome Lists containing this project

README

        

# Yarr!

[![Circle CI](https://img.shields.io/circleci/project/bluecap-se/yarr.svg?style=flat-square)](https://circleci.com/gh/bluecap-se/yarr)
[![Dependency Status](https://img.shields.io/gemnasium/bluecap-se/yarr.svg?style=flat-square)](https://gemnasium.com/bluecap-se/yarr)
[![NPM version](https://img.shields.io/npm/v/yarr.svg?style=flat-square)](https://www.npmjs.com/package/yarr)
[![Docker pulls](https://img.shields.io/docker/pulls/bluecap/yarr.svg?style=flat-square)](https://registry.hub.docker.com/u/bluecap/yarr/)

*I feel lucky*, for [The Pirate Bay](https://thepiratebay.se/). 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

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

#### Using a package manager

```console
$ npm install yarr
```

## Usage

```console
$ yarr
Server started on localhost:8080
```

This will start the HTTP server, with [default config](https://github.com/bluecap-se/yarr/blob/master/lib/defaults.json).
Then navigate to [localhost:8080](http://localhost:8080)

### Full options

```console
$ yarr -h

I feel lucky, for The Pirate Bay

Usage:
yarr []
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](https://docs.docker.com/reference/commandline/run/).

```console
$ 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](https://github.com/jakubroztocil/httpie) is used when calling the API over HTTP. Using Curl is another option.

```console
$ 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](http://stedolan.github.io/jq/) is used to parse the result from Yarr!. The result can then be piped to a torrent application of your choice.

```console
$ 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.

```console
$ 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!

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

## Run tests

```console
$ make test
```

## License

Published under [MIT License](https://github.com/bluecap-se/yarr/blob/master/LICENSE).