Node.js client for ncore.pro — search, download, rss feed, etc.
- Original Python lib by @radaron — big kudos!
- Ported to JS/Node and npm packaging by @alexgabe-dev
Heads-up: this is an unofficial client. Site HTML may change :) I try to keep up but no promises.
npm i js-ncoreparserimport { Client, SearchParamType, ParamSort, ParamSeq } from 'js-ncoreparser';
(async () => {
const client = new Client();
await client.login('username', 'password');
const result = await client.search(
'',
SearchParamType.HD_HUN,
undefined,
ParamSort.SEEDERS,
ParamSeq.DECREASING,
);
console.log(result.torrents[0].get('title'));
await client.logout();
})();- Copy
.env.exampleto.envand fill in:NCORE_USERNAMENCORE_PASSWORDRSS_URL
- If you want to load from
.envin your app,npm i dotenvand call:import 'dotenv/config';
Client.login(username, password)— creates a sesion (cookies kept internally)Client.search(pattern, type?, where?, sortBy?, sortOrder?, page?)→{ torrents, numOfPages }Client.getTorrent(id, extraParams?)→TorrentClient.getByRss(url)→AsyncGenerator<Torrent>Client.getByActivity()→Promise<Torrent[]>Client.getRecommended(type?)→AsyncGenerator<Torrent>Client.download(torrent, path, override?)→ saves.torrentfileClient.logout()— clears cookies, ends sesion
Torrent goodies:
torrent.get('title'|'size'|'download'|'url'|...)
Also exposed enums and helpers: SearchParamType, SearchParamWhere, ParamSort, ParamSeq, Size, getTorrentPageUrl.
- HTML parsing uses regex and some assumptions. If it breaks after a site update, plz open an issue.
MIT