torrent-grabber
v1.0.2
Published
Simple torrent search engine
Downloads
122
Maintainers
Readme
Torrent Grabber
Fast torrent search module for nodejs
List of available trackers
- 1337x
- ThePirateBay
- Nnm
- Rutracker
Installation
$ npm i torrent-grabber
Example Single
Activation needs only once, for checking tracker availability and login
const tg = require("torrent-grabber");
tg.activate("ThePirateBay").then(name => {
console.log(`${name} is ready!`);
tg.search("the greatest showman", {
groupByTracker: false
}).then(items => console.log(items));
});
Example Multiple
const tg = require("torrent-grabber");
const trackersToUse = [
"1337x",
"ThePirateBay",
"Nnm",
["Rutracker", { login: "login", pass: "pass" }]
];
Promise.all(
trackersToUse.map(tracker => {
return tg.activate(tracker).then(name => {
console.log(`${name} is ready!`);
});
})
).then(() => {
tg.search("the greatest showman", {
groupByTracker: false
}).then(items => console.log(items));
});
//or async/await
(async () => {
await Promise.all(trackersToUse.map(tracker => tg.activate(tracker)));
const searchResult = await tg.search("the greatest showman", {
groupByTracker: false
});
console.log(searchResult);
const magnetURI = await tg.getMagnet(searchResult[20]);
console.log(magnetURI);
})();
API
Activating tracker
tg.activate(trackerName).then(name => {
console.log(`${name} is ready!`);
});
//or
tg.activate([trackerName, { login: "login", pass: "pass" }]).then(name => {
console.log(`${name} is ready!`);
});
Disabling tracker
tg.disable(trackerName);
Searching
tg.search(query, { groupByTracker: false }).then(items => console.log(items));
Get magnetURI
tg.getMagnet(torrentItem).then(magnet => console.log(magnet));
Authors
- Lennart Le
License
MIT License