Comments (6)
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)
from torrent-search-api.
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.
I'm giving you my code in case you have an idea...
const format = require('string-format');
export function yggTorrentProviderOverride(yggTorrentProvider: any) {
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: YggQuery): string => {
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: 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: any) => {
await yggTorrentProvider.ensureLogin();
return yggTorrentProvider.request(torrent.link, { encoding: null }).then((r: any) => r.body);
}
}
export class YggQuery {
query: string;
cat: string = 'all';
order?: string = 'desc';
sort?: string = 'publish_date';
page?: number = 0;
}
from torrent-search-api.
Sorry I can't help you for now : I know this package only for 2 hours ^^
from torrent-search-api.
@exasky From what I seed, you're only trying to add order
, sort
, and page
to the url, don't you ?
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);
}
})();
from torrent-search-api.
Fixed in 2.1.1
from torrent-search-api.
Works like a charm !!
Thank you 😊
from torrent-search-api.
Related Issues (20)
- Feature req: Specify scrapes for only webtorrents HOT 2
- Yggtorrent - CaptchaError: captcha HOT 19
- Rarbg not working anymore HOT 1
- Error :: Module not found: Can't resolve '_http_common'
- TypeError: TorrentSearchApi is not a function HOT 11
- IPTorrents Authentication Doesn't Work HOT 8
- ThePirateBay doesn't seem to be working HOT 8
- Can't Deploy in Heroku HOT 3
- Provider ThePirateBay magnet name undefined
- cannot read property "toLowerCase' of undefined when getting magnet links HOT 3
- Suggestions about request and bluebird HOT 3
- [YGGTorrent] Error in torrent file HOT 2
- Unable to use Ygg provider HOT 14
- eztv.io changed to eztv.re HOT 1
- [Docs] No Custom Provider documentation
- uniqueName error when passed a number HOT 1
- this npm package requires netmask@^1.0.6 via a transitive dependency on [email protected]
- Error in searching torrents HOT 1
- Dead repo ? HOT 1
- Udpate YggTorrent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent-search-api.