Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getAllTorrents(totalPages: number): Promise> {
let torrents = []
return pTimes(totalPages, async page => {
this.query.page = page + 1
logger.info(`${this.name}: Started searching ${this.name} on page ${page + 1} out of ${totalPages}`)
const res = await this.api.search(this.query)
const data = res.results
? res.results // Kat & ET
: res.data
? res.data.movies // YTS
: res.torrents
? res.torrents // Nyaa
: []
torrents = torrents.concat(data)
}, {
concurrency: 1
}).then(() => {