-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
453 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
|
||
<a name="1.0.2"></a> | ||
## [1.0.2](https://github.com/ChrisAlderson/ettv-api/compare/v1.0.1...v1.0.2) (2018-05-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* fix memory issue in full database dump ([4aa0911](https://github.com/ChrisAlderson/ettv-api/commit/4aa0911)) | ||
|
||
|
||
|
||
<a name="1.0.1"></a> | ||
## [1.0.1](https://github.com/ChrisAlderson/ettv-api/compare/v1.0.0...v1.0.1) (2018-01-25) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* Dump got ([#1](https://github.com/ChrisAlderson/ettv-api/issues/1)) ([3455ad4](https://github.com/ChrisAlderson/ettv-api/commit/3455ad4)) | ||
|
||
|
||
|
||
<a name="1.0.0"></a> | ||
# 1.0.0 (2018-01-24) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* Fix david url for shield ([b3204a2](https://github.com/ChrisAlderson/ettv-api/commit/b3204a2)) | ||
|
||
|
||
### Features | ||
|
||
* Add ability to parse the daily and full database dumps from ettv.tv ([28d3214](https://github.com/ChrisAlderson/ettv-api/commit/28d3214)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 - ettv-api - Released under the MIT license. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# ettv-api | ||
|
||
[![Build Status][travis-image]][travis-url] | ||
[![Coverage Status][coveralls-image]][coveralls-url] | ||
[![Dependency Status][david-image]][david-url] | ||
[![devDependency Status][david-dev-image]][david-dev-url] | ||
[![Conventional Commits][commits-image]][commits-url] | ||
|
||
[travis-image]: https://travis-ci.org/ChrisAlderson/ettv-api.svg?branch=master | ||
[travis-url]: https://travis-ci.org/ChrisAlderson/ettv-api | ||
[coveralls-image]: https://coveralls.io/repos/github/ChrisAlderson/ettv-api/badge.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/github/ChrisAlderson/ettv-api?branch=master | ||
[david-image]: https://david-dm.org/ChrisAlderson/ettv-api.svg | ||
[david-url]: https://david-dm.org/ChrisAlderson/ettv-api | ||
[david-dev-image]: https://david-dm.org/ChrisAlderson/ettv-api/dev-status.svg | ||
[david-dev-url]: https://david-dm.org/ChrisAlderson/ettv-api?type=dev | ||
[commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg | ||
[commits-url]: https://conventionalcommits.org | ||
|
||
An ETTV API wrapper for NodeJS. | ||
|
||
## Installation | ||
|
||
``` | ||
$ npm install --save ettv-api | ||
``` | ||
|
||
## Usage | ||
|
||
### Initialize | ||
|
||
```js | ||
const EttvApi = require('ettv-api') | ||
|
||
const ettvApi = new EttvApi([{ | ||
baseUrl: string, // The base url of ettv.tv. Defaults to | ||
// 'https://www.ettv.tv/'. | ||
trackers: Array<string> // A list of trackers to add to the hahs of the | ||
// torrents. Defaults to 'exports.defaultTrackers'. | ||
}]) | ||
``` | ||
|
||
### Methods | ||
|
||
```js | ||
// ettvApi.getDaily() // For the daily database dump. | ||
// ettvApi.getFull() // For the full database dump. | ||
|
||
// Both methods return a promise with | ||
ettvApi.getDaily().then(res => { | ||
const [ torrent ] = res | ||
// Or without array destructuring: | ||
// const torrent = res[0] | ||
|
||
console.log(torrent) | ||
// { | ||
// hash: '97f6b9c0b27061fb76aa4963918668b13644be3a', | ||
// title: 'NCIS.New.Orleans.S04E13.HDTV.x264-LOL[ettv]', | ||
// category: 'TV', | ||
// link: 'https://www.ettv.tv/torrent/ncis-new-orleans-s04e13-hdtv-x264-lol-ettv--69855', | ||
// magnet: '$magnet:?xt=urn%3Abtih%3A97f6b9c0b27061fb76aa4963918668b13644be3a&dn=NCIS.New.Orleans.S04E13.HDTV.x264-LOL%5Bettv%5D&tr=udp%253A%252F%252Ftracker.coppersurfer.tk%3A6969%2Fannounce%26&tr=udp%253A%252F%252F9.rarbg.to%3A2710%2Fannounce%26&tr=udp%253A%252F%252F9.rarbg.me%3A2710%2Fannounce%26&tr=udp%253A%252F%252FIPv6.open-internet.nl%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.internetwarriors.net%3A1337%2Fannounce%26&tr=udp%253A%252F%252Ftracker.opentrackr.org%3A1337%2Fannounce%26&tr=udp%253A%252F%252Fp4p.arenabg.com%3A1337%2Fannounce%26&tr=udp%253A%252F%252Feddie4.nl%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fshadowshq.yi.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.leechers-paradise.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fexplodie.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.tiny-vps.com%3A6969%2Fannounce%26&tr=udp%253A%252F%252Finferno.demonoid.pw%3A3391%2Fannounce%26&tr=udp%253A%252F%252Fipv4.tracker.harry.lu%3A80%2Fannounce%26&tr=udp%253A%252F%252Fpeerfect.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.pirateparty.gr%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.vanitycore.co%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fopen.stealth.si%3A80%2Fannounce%26&tr=udp%253A%252F%252Ftracker.torrent.eu.org%3A451%26&tr=udp%253A%252F%252Ftracker.zer0day.to%3A1337%2Fannounce%26&tr=udp%253A%252F%252Ftracker.open-internet.nl%3A6969%2Fannounce' | ||
// } | ||
}).catch(err => console.error(err)) | ||
``` | ||
|
||
## Test | ||
|
||
Tests are written with [MochaJS](https://mochajs.org/) and | ||
[Chai](http://chaijs.com/). | ||
|
||
``` | ||
$ npm run test | ||
``` | ||
|
||
## License | ||
|
||
MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable max-len */ | ||
'use strict' | ||
|
||
const EttvApi = require('..') | ||
|
||
const ettvApi = new EttvApi() | ||
|
||
// ettvApi.getDaily() // For the daily database dump. | ||
// ettvApi.getFull() // For the full database dump. | ||
|
||
// Both methods return a promise with | ||
ettvApi.getDaily(['Movies']).then(res => { | ||
const [torrent] = res | ||
// Or without array destructuring: | ||
// const torrent = res[0] | ||
|
||
console.log(res) | ||
// { | ||
// hash: '97f6b9c0b27061fb76aa4963918668b13644be3a', | ||
// title: 'NCIS.New.Orleans.S04E13.HDTV.x264-LOL[ettv]', | ||
// category: 'TV', | ||
// link: 'https://www.ettv.tv/torrent/ncis-new-orleans-s04e13-hdtv-x264-lol-ettv--69855', | ||
// magnet: '$magnet:?xt=urn%3Abtih%3A97f6b9c0b27061fb76aa4963918668b13644be3a&dn=NCIS.New.Orleans.S04E13.HDTV.x264-LOL%5Bettv%5D&tr=udp%253A%252F%252Ftracker.coppersurfer.tk%3A6969%2Fannounce%26&tr=udp%253A%252F%252F9.rarbg.to%3A2710%2Fannounce%26&tr=udp%253A%252F%252F9.rarbg.me%3A2710%2Fannounce%26&tr=udp%253A%252F%252FIPv6.open-internet.nl%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.internetwarriors.net%3A1337%2Fannounce%26&tr=udp%253A%252F%252Ftracker.opentrackr.org%3A1337%2Fannounce%26&tr=udp%253A%252F%252Fp4p.arenabg.com%3A1337%2Fannounce%26&tr=udp%253A%252F%252Feddie4.nl%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fshadowshq.yi.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.leechers-paradise.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fexplodie.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.tiny-vps.com%3A6969%2Fannounce%26&tr=udp%253A%252F%252Finferno.demonoid.pw%3A3391%2Fannounce%26&tr=udp%253A%252F%252Fipv4.tracker.harry.lu%3A80%2Fannounce%26&tr=udp%253A%252F%252Fpeerfect.org%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.pirateparty.gr%3A6969%2Fannounce%26&tr=udp%253A%252F%252Ftracker.vanitycore.co%3A6969%2Fannounce%26&tr=udp%253A%252F%252Fopen.stealth.si%3A80%2Fannounce%26&tr=udp%253A%252F%252Ftracker.torrent.eu.org%3A451%26&tr=udp%253A%252F%252Ftracker.zer0day.to%3A1337%2Fannounce%26&tr=udp%253A%252F%252Ftracker.open-internet.nl%3A6969%2Fannounce' | ||
// } | ||
}).catch(err => console.error(err)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "@pct-org/ettv-api", | ||
"version": "0.0.1" | ||
"version": "0.0.1", | ||
"main": "src/index.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use strict' | ||
|
||
const { expect } = require('chai') | ||
const { URL } = require('url') | ||
|
||
const EttvApi = require('..') | ||
|
||
/** @test {EttvApi} */ | ||
describe('EttvApi', () => { | ||
/** | ||
* The instance of the module to test. | ||
* @type {EttvApi} | ||
*/ | ||
let ettvApi | ||
|
||
/** | ||
* Hook for setting up the EttvApi tests. | ||
* @type {Function} | ||
*/ | ||
before(() => { | ||
ettvApi = new EttvApi() | ||
}) | ||
|
||
/** @test {EttvApi#constructor} */ | ||
it('should create an instance of EttvApi with parameters', () => { | ||
const ettvApi = new EttvApi({ | ||
baseUrl: 'https://mybaseurl.com/', | ||
trackers: '' | ||
}) | ||
|
||
expect(ettvApi).to.be.an.instanceOf(EttvApi) | ||
expect(ettvApi._baseUrl).to.be.a('string') | ||
expect(ettvApi._baseUrl).to.equal('https://mybaseurl.com/') | ||
expect(ettvApi._trackers).to.be.a('string') | ||
expect(ettvApi._trackers).to.equal('') | ||
expect(ettvApi._debug).to.be.a('function') | ||
}) | ||
|
||
/** @test EttvApi#_get} */ | ||
it('should throw an error when getting an incorrect endpoint', done => { | ||
const { href } = new URL('faulty', ettvApi._baseUrl) | ||
ettvApi._get(href) | ||
.then(done) | ||
.catch(err => { | ||
expect(err).to.be.an('Error') | ||
done() | ||
}) | ||
}) | ||
|
||
/** | ||
* Helper function to test the properties of a torrent object. | ||
* @param {!Torrent} torrent - The torrent object to test. | ||
* @returns {undefined} | ||
*/ | ||
function testTorrent(torrent) { | ||
expect(torrent).to.be.an('object') | ||
expect(torrent.hash).to.be.a('string') | ||
expect(torrent.magnet).to.be.a('string') | ||
expect(torrent.title).to.be.a('string') | ||
expect(torrent.category).to.be.a('string') | ||
expect(torrent.link).to.be.a('string') | ||
} | ||
|
||
/** | ||
* Helper function to test the properties of an api call. | ||
* @param {!Array<Torrent>} res - The response of the api call. | ||
* @returns {undefined} | ||
*/ | ||
function testResponse(res) { | ||
expect(res).to.be.an('array') | ||
expect(res.length).to.be.at.least(1) | ||
|
||
const random = Math.floor(Math.random() * res.length) | ||
const toTest = res[random] | ||
testTorrent(toTest) | ||
} | ||
|
||
/** @test {EttvApi#getDaily} */ | ||
it('should get the daily database dump', done => { | ||
ettvApi.getDaily().then(res => { | ||
testResponse(res) | ||
done() | ||
}).catch(done) | ||
}) | ||
|
||
/** @test {EttvApi#getFull} */ | ||
it('should get the full database dump', done => { | ||
ettvApi.getFull().then(res => { | ||
testResponse(res) | ||
done() | ||
}).catch(done) | ||
}) | ||
}) |
Oops, something went wrong.