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 🙏

© 2026 – Pkg Stats / Ryan Hefner

frenchtorrentdb-api

v0.1.0

Published

Frenchtorrent pseudo rest api

Readme

FrenchTorrentDB-API

Node module designed to expose a "pseudo" api from FrenchtorrentDB, a French private tracker. For the moment, only torrent search is supported.

Installation

npm install frenchtorrentdb-api

Usage

var FTDBClient = require('frenchtorrentdb-api'); 


var FTDB = new FTDBClient(); //instanciate a new Client.

Credential

Before performing any action, you must define credential to log in to FTDB tracker with.

You can assign credential programmatically.

FTDB.setCredential(credentials.username, credentials.password);

Or load credential from a file.

FTDB.loadCredential('./credentials.json');

Credential file is simply a .json file which contains login information this way:

{
	"username" 	: "mycoolusername",
	"password"	: "this_is_my_passw0rd"	
}

Login

Once, credential is defined, you can perform login process by calling login() which return a Promise.

FTDB.login()
.then(function(res)
{
	if(res)
	{
		console.log("Ok, i'm logged in, what's next?")
	}
	else
		new Error('Login failed'));
})
.catch(console.error);

You can also chain calls:

FTDB
	.loadCredential('./credential.json')
	.login()
	.then(function(res)
	{
		... some code here
	})
	.catch(console.error);

API

Search

For now, search action is the only supported. You can search against any form from:

http://www.frenchtorrentdb.com/?section=TORRENTS.

Search is based on definition json files, generated by a script (scripts/installSearch) and located into search folder. You can easily create your own for a custom search with fixed values by editing/copying an existing one.

To perform a search, just call .search.<searchformname>(<form values>) where searchformname is basically the basename of our definition file from search folder.

exemple:

I want to search for an episode of my favorite show

FTDB.search.serie({ name : 'EVERYBODY.HATES.CHRIS.iNTEGRALE.FRENCH.DVDRIP.XVID-NoTaG' })
	.then(function(result)
	{
		... result is and instance of SearchResult;
	})
	.catch(next);

Class: SearchResult

Represents a result set associated to a search action

Predefined Constants

The constants below are defined by the module.

Constant | Description --- | --- SearchResult.FETCH_JSON | Specifies that the fetch method shall return each row as an object with property names that correspond to column names returned in the result set. SearchResult.FETCH_ARRAY | Specifies that the fetch method shall return each row as an array indexed by column number as returned in the corresponding result set, starting at column 0. SearchResult.FETCH_XML | Specifies that the fetch method shall return each row as a xml fragment with sub element tagname that correspond to column names returned in the result set.

Prototype Methods

These methods are invoked on a SearchResult instance by calling SearchResult.methodName

SearchResult#fetch([fetchStyle[, fetchOptions])

Fetches the next row from a result set.

Examples

Example#1 : Fetching rows using different fetch style

FTDB.search.series({ name : 'walking' })
	.then(function(result)
	{

		console.log('SearchResult.FETCH_JSON: return next row as anonymous object with column names as properties');
		console.log(result.fetch(SearchResult.FETCH_JSON));

		console.log('SearchResult.FETCH_XML: return next row as XML fragment named "torrent" with column names as sub element ');
		console.log(result.fetch(SearchResult.FETCH_XML, 'torrent'));

		console.log('SearchResult.FETCH_ARRAY: return next row as an array indexed by number');
		console.log(result.fetch(SearchResult.FETCH_ARRAY));

		next();
	})
	.catch(next);

the above example will ouput:

SearchResult.FETCH_JSON: return next row as anonymous object with column names as properties

{ categories_parent_cat: '',
  categories_parent_cat_link: '?section=TORRENTS&module=&parent_cat_id=13',
  torrents_category: 'XviD',
  torrents_category_link: '?section=TORRENTS&module=&parent_cat_id=13&cid=101',
  torrents_name: 'The.Walking.Dead.S05E13.FASTSUB.VOSTFR.HDTV.XviD-ADDiCTiON',
  torrents_name_link: '/?section=INFOS&hash=000C5AA...#FTD_MENU',
  torrents_size: '349.04 MB',
  torrents_seeders: '2862',
  torrents_leechers: '26',
  imdb_id_imdb_id: '',
  torrents_calendar: '',
  torrents_download: '',
  torrents_download_link: '/?section=DOWNLOAD&id=652..&uid=80...&get=1&hash=63e4a65...' }

SearchResult.FETCH_XML: return next row as XML fragment named "torrent" with column names as sub element 

<torrent>
	<categories_parent_cat></categories_parent_cat>
	<categories_parent_cat_link>?section=TORRENTS&module=&parent_cat_id=13</categories_parent_cat_link>
	<torrents_category>XviD</torrents_category>
	<torrents_category_link>?section=TORRENTS&module=&parent_cat_id=13&cid=101</torrents_category_link>
	<torrents_name>The.Walking.Dead.S05E15.FASTSUB.VOSTFR.HDTV.XviD-ADDiCTiON</torrents_name>
	<torrents_name_link>/?section=INFOS&hash=000C5AA...#FTD_MENU</torrents_name_link>
	<torrents_size>349.12 MB</torrents_size>
	<torrents_seeders>2274</torrents_seeders>
	<torrents_leechers>10</torrents_leechers>
	<imdb_id_imdb_id></imdb_id_imdb_id>
	<torrents_calendar></torrents_calendar>
	<torrents_download></torrents_download>
	<torrents_download_link>/?section=DOWNLOAD&id=6544..&uid=809..&get=1&hash=e78bd7b1...</torrents_download_link>
</torrent>

SearchResult.FETCH_ARRAY: return next row as an array indexed by number

[ '',
  '?section=TORRENTS&module=&parent_cat_id=13',
  'XviD',
  '?section=TORRENTS&module=&parent_cat_id=13&cid=101',
  'The.Walking.Dead.S05E05.FASTSUB.VOSTFR.HDTV.XviD-ADDiCTiON',
  '/?section=INFOS&hash=000C5AA5...#FTD_MENU',
  '349.14 MB',
  '2246',
  '4',
  '',
  '',
  '',
  '/?section=DOWNLOAD&id=632..&uid=80..&get=1&hash=6f382....' ]

Example#2 : Fetching result set as xml

FTDB.search.series({ name : 'game of', season : '01', episode : '01' })
	.then(function(result)
	{
		var row, xml=[
			"<?xml version='1.0' encoding='ISO-8859-1' ?>",
			'<torrents>'
		];

		while(row=result.fetch(SearchResult.FETCH_XML, 'item'))
			xml.push('\t'+row.replace(/&/g, '&amp;'));

		xml.push('</torrents>');

		console.log(xml.join('\n'));

		next();
	})
	.catch(next);

the above example will ouput:

<?xml version='1.0' encoding='ISO-8859-1' ?>
<torrents>
	<item>
	<categories_parent_cat></categories_parent_cat>
	<categories_parent_cat_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=12</categories_parent_cat_link>
	<torrents_category></torrents_category>
	<torrents_category_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=12&amp;cid=95</torrents_category_link>
	<torrents_name>Game.Of.Thrones.S01E01.FRENCH.BDRip.XviD-JMT</torrents_name>
	<torrents_name_link>/?section=INFOS&amp;hash=000C5AA500..#FTD_MENU</torrents_name_link>
	<torrents_size>550.12 MB</torrents_size>
	<torrents_seeders>55</torrents_seeders>
	<torrents_leechers>0</torrents_leechers>
	<imdb_id_imdb_id></imdb_id_imdb_id>
	<torrents_calendar></torrents_calendar>
	<torrents_download></torrents_download>
	<torrents_download_link>/?section=DOWNLOAD&amp;id=3761..&amp;uid=8096..&amp;get=1&amp;hash=200c0f93e5..</torrents_download_link>
</item>
	<item>
	<categories_parent_cat></categories_parent_cat>
	<categories_parent_cat_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=36</categories_parent_cat_link>
	<torrents_category></torrents_category>
	<torrents_category_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=36&amp;cid=190</torrents_category_link>
	<torrents_name>Game.Of.Thrones.S01E01.FRENCH.720P.BluRay.x264-JMT</torrents_name>
	<torrents_name_link>/?section=INFOS&amp;hash=000C5AA500..#FTD_MENU</torrents_name_link>
	<torrents_size>2.19 GB</torrents_size>
	<torrents_seeders>4</torrents_seeders>
	<torrents_leechers>0</torrents_leechers>
	<imdb_id_imdb_id></imdb_id_imdb_id>
	<torrents_calendar></torrents_calendar>
	<torrents_download></torrents_download>
	<torrents_download_link>/?section=DOWNLOAD&amp;id=3761..&amp;uid=8096..&amp;get=1&amp;hash=c1a99a4589..</torrents_download_link>
</item>
	<item>
	<categories_parent_cat></categories_parent_cat>
	<categories_parent_cat_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=36</categories_parent_cat_link>
	<torrents_category></torrents_category>
	<torrents_category_link>?section=TORRENTS&amp;module=&amp;parent_cat_id=36&amp;cid=190</torrents_category_link>
	<torrents_name>Game.Of.Thrones.S01E01.FRENCH.720P.HDTV.x264-BAWLS</torrents_name>
	<torrents_name_link>/?section=INFOS&amp;hash=000C5AA500..#FTD_MENU</torrents_name_link>
	<torrents_size>1.62 GB</torrents_size>
	<torrents_seeders>6</torrents_seeders>
	<torrents_leechers>0</torrents_leechers>
	<imdb_id_imdb_id></imdb_id_imdb_id>
	<torrents_calendar></torrents_calendar>
	<torrents_download></torrents_download>
	<torrents_download_link>/?section=DOWNLOAD&amp;id=3535..&amp;uid=8096..&amp;get=1&amp;hash=50e4c6e7ba..</torrents_download_link>
</item>
...
...
</torrents>

SearchResult#fetchAll([fetchStyle[, fetchOptions])

Returns an array containing all of the result set rows

Examples

Fetch all rows as object/json

FTDB.search.series({ name : 'game of', season : '01', episode : '01' })
	.then(function(result)
	{
		console.log(result.fetchAll(SearchResult.FETCH_JSON));
		next();
	})
	.catch(next);

the above example will ouput:

[ { categories_parent_cat: '',
    categories_parent_cat_link: '?section=TORRENTS&module=&parent_cat_id=12',
    torrents_category: '',
    torrents_category_link: '?section=TORRENTS&module=&parent_cat_id=12&cid=95',
    torrents_name: 'Game.Of.Thrones.S01E01.FRENCH.BDRip.XviD-JMT',
    torrents_name_link: '/?section=INFOS&hash=000C5AA500..#FTD_MENU',
    torrents_size: '550.12 MB',
    torrents_seeders: '55',
    torrents_leechers: '0',
    imdb_id_imdb_id: '',
    torrents_calendar: '',
    torrents_download: '',
    torrents_download_link: '/?section=DOWNLOAD&id=3761..&uid=8096..&get=1&hash=200c0f93e5..' },
  { categories_parent_cat: '',
    categories_parent_cat_link: '?section=TORRENTS&module=&parent_cat_id=36',
    torrents_category: '',
    torrents_category_link: '?section=TORRENTS&module=&parent_cat_id=36&cid=190',
    torrents_name: 'Game.Of.Thrones.S01E01.FRENCH.720P.BluRay.x264-JMT',
    torrents_name_link: '/?section=INFOS&hash=000C5AA500..#FTD_MENU',
    torrents_size: '2.19 GB',
    torrents_seeders: '4',
    torrents_leechers: '0',
    imdb_id_imdb_id: '',
    torrents_calendar: '',
    torrents_download: '',
    torrents_download_link: '/?section=DOWNLOAD&id=3761..&uid=8096..&get=1&hash=c1a99a4589..' },
  { categories_parent_cat: '',
    categories_parent_cat_link: '?section=TORRENTS&module=&parent_cat_id=36',
    torrents_category: '',
    torrents_category_link: '?section=TORRENTS&module=&parent_cat_id=36&cid=190',
    torrents_name: 'Game.Of.Thrones.S01E01.FRENCH.720P.HDTV.x264-BAWLS',
    torrents_name_link: '/?section=INFOS&hash=000C5AA500..#FTD_MENU',
    torrents_size: '1.62 GB',
    torrents_seeders: '6',
    torrents_leechers: '0',
    imdb_id_imdb_id: '',
    torrents_calendar: '',
    torrents_download: '',
    torrents_download_link: '/?section=DOWNLOAD&id=3535..&uid=8096..&get=1&hash=50e4c6e7ba..' },
...
]

SearchResult#rowCount()

Returns the number of rows returned by search action