Habibouldmoussa / torrent-search-api-for-barbaroussa

Yet another node torrent scraper (supports iptorrents, torrentleech, torrent9, torrentz2, 1337x, thepiratebay, Yggtorrent, TorrentProject, Eztv, Yts, LimeTorrents)
MIT License
2 stars 0 forks source link

BUG: enable more than 20 results #1

Open ralyodio opened 2 months ago

ralyodio commented 2 months ago

I'm doing enablePublicProviders() and I only get 20 results back, is it possible to give me more results and possibly 20 from each provider?

ralyodio commented 2 months ago

This code only returns 20 results, can we get data from each provider enabled??

async search(q, mediaType = '') {
            let torrents = [];

            // Torrent.enablePublicProviders();
            for (let provider of [
                '1337x',
                'Torrent9',
                'Torrentz2',
                'KickassTorrents',
                'Rarbg',
                'Yts',
                'TorrentProject',
                'Limetorrents',
                'Eztv'
            ]) {
                Torrent.enableProvider(provider);
            }

            try {
                torrents = await Torrent.search(q, mediaType, 20);

                for (let torrent of torrents) {
                    try {
                        const magnet = await Torrent.getMagnet(torrent);
                        console.log('magnet:', magnet);
                        if (!magnet) continue;
                        torrent.magnet = magnet;
                    } catch (err) {
                        console.error(err);
                        continue;
                    }
                }
            } catch (err) {
                console.error(err);
            }

            console.log(torrents);

            return torrents;
        }
Habibouldmoussa commented 2 months ago

can you find a way to create a pagination system ?

ralyodio commented 2 months ago

pagination should be done client side. its too complicated to use scraping for that.