81 lines
1.4 KiB
JavaScript
Executable File
81 lines
1.4 KiB
JavaScript
Executable File
const YGG = require('yggtorrent');
|
|
var client = new YGG();
|
|
|
|
client.set_credential('kopa4', 'Ck695bvkyvPT0PJeYMOPUc');
|
|
|
|
/*
|
|
|
|
// list categories
|
|
client.get_categories(function(result) {
|
|
console.log(result);
|
|
});
|
|
|
|
// get nfo as text file
|
|
client.get_nfo(function(result) {
|
|
console.log(result);
|
|
}, id);
|
|
|
|
// get description as htlm format
|
|
client.get_info(function(result) {
|
|
console.log(result);
|
|
}, id);
|
|
|
|
// search torrents
|
|
client.search(function(result, page) {
|
|
console.log(result, page);
|
|
}, 'interstellar');
|
|
|
|
// download and parse a .torrent
|
|
client.get_torrent(function(buf, error) {
|
|
// `buf` is a Buffer or null, `error` is string or null
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
{
|
|
var parsed = require('parse-torrent')(buf);
|
|
console.log(parsed);
|
|
}
|
|
}, id);
|
|
|
|
// get top day torrents
|
|
client.get_top_day(function(result, error) {
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
console.log(result);
|
|
});
|
|
|
|
// get top week torrents
|
|
client.get_top_week(function(result, error) {
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
console.log(result);
|
|
});
|
|
|
|
// get top month torrents
|
|
client.get_top_month(function(result, error) {
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
console.log(result);
|
|
});
|
|
|
|
// get most seeded torrents
|
|
client.get_mostseeded(function(result, error) {
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
console.log(result);
|
|
});
|
|
|
|
// get most completed torrents
|
|
client.get_mostcompleted(function(result, error) {
|
|
if (error)
|
|
console.log(error);
|
|
else
|
|
console.log(result);
|
|
});
|
|
|
|
*/
|