-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't download with yggtorrent #96
Comments
Hi, have you tried to override the default yggtorrent url ? Because yggtorrent url has changed. const torrentSearch = require('torrent-search-api');
torrentSearch.overrideConfig('YggTorrent', {
baseUrl: 'https://www2.yggtorrent.se/' // The new YGGtorrent url
});
torrentSearch.enableProvider('YggTorrent', 'USERNAME', 'PASSWORD');
torrentSearch.search('1080', 'Movies', 20).then(res => {
console.log(res);
torrentSearch.downloadTorrent(res[0], '/tmp/test.torrent').then(success => {
console.log('downloaded', success);
}).catch(err => console.error('ERR : ', err));
}); This code work for me (until the url change again... please check https://mamot.fr/@YggTorrent if you want to know the current yggtorrent url and avoid phishing web sites) |
Wokay, your method works indeed. In my code I overrided the getUrl & search method to fit my need, can't figure out why it isn't working. I only override the search & getUrl part, not the download part.
|
Sorry I can't help you for now : I know this package only for 2 hours ^^ |
@exasky From what I seed, you're only trying to add I tried you're code and except a minor change to work with the last release, everything seems to be ok. Check this out and tell me: const format = require('string-format');
const YggTorrentProvider = require('torrent-search-api/providers/yggtorrent');
function yggTorrentProviderOverride(yggTorrentProvider) {
yggTorrentProvider.baseUrl = 'https://www2.yggtorrent.se';
yggTorrentProvider.searchUrl =
'/engine/search?name={query}&description=&file=&uploader=&category={cat}&do=search&order={order}&sort={sort}&page={page}';
yggTorrentProvider.getUrl = queryString => {
const cat = yggTorrentProvider.getCategoryValue(queryString.cat);
if (cat === null) return null;
queryString.cat = cat;
let url =
yggTorrentProvider.baseUrl +
(cat.startsWith('url:') ? cat.substr(4) : yggTorrentProvider.searchUrl);
url = format(url, queryString);
url = url.replace(/ /g, '+');
return url;
};
yggTorrentProvider.search = async yggQuery => {
const pageLimit = 1;
const url = yggTorrentProvider.getUrl(yggQuery);
if (!url) {
return Promise.resolve();
}
await yggTorrentProvider.ensureLogin();
const result = await yggTorrentProvider.fetchAndParseUrl(url, pageLimit);
const returnValue = await yggTorrentProvider.postProcess(result);
return returnValue;
};
yggTorrentProvider.downloadTorrentBuffer = async torrent => {
await yggTorrentProvider.ensureLogin();
return yggTorrentProvider.request(torrent.link, { encoding: null }); // .then(r => r.body); <= not needed in the last release
};
}
(async () => {
try {
const yggTorrentProvider = new YggTorrentProvider();
yggTorrentProvider.setCredentials('login', 'password');
yggTorrentProvider.isActive = true;
yggTorrentProviderOverride(yggTorrentProvider);
const torrents = await yggTorrentProvider.search({ cat:'', query:'blabla', order: 'seeds'});
await yggTorrentProvider.downloadTorrent(torrents[0], 'blabla.torrent');
console.log(torrents);
} catch (e) {
console.log(e);
}
})(); |
Fixed in 2.1.1 |
Works like a charm !! |
When I try to download with yggTorrent provider I always get this error in the downloaded file : "Vous devez vous connecter pour télécharger un torrent" (You must be logged in to download a torrent)
I guess the authentication isn't working.
The text was updated successfully, but these errors were encountered: