mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
Updated scrapers to latest available commit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const { si } = require('nyaapi')
|
||||
const { parseSize } = require("../scraperHelper");
|
||||
|
||||
const Categories = {
|
||||
ANIME: {
|
||||
@@ -34,7 +35,7 @@ function torrent(torrentId) {
|
||||
}
|
||||
|
||||
function search(query) {
|
||||
return si.search(query)
|
||||
return si.search(query, null, { category: Categories.ANIME.ENGLISH})
|
||||
.then(results => results.map(torrent => parseTorrent(torrent)));
|
||||
}
|
||||
|
||||
@@ -62,19 +63,4 @@ function parseTorrent(torrent) {
|
||||
}
|
||||
}
|
||||
|
||||
function parseSize(sizeText) {
|
||||
if (!sizeText) {
|
||||
return undefined;
|
||||
}
|
||||
let scale = 1;
|
||||
if (sizeText.includes('GiB')) {
|
||||
scale = 1024 * 1024 * 1024
|
||||
} else if (sizeText.includes('MiB')) {
|
||||
scale = 1024 * 1024;
|
||||
} else if (sizeText.includes('KiB') || sizeText.includes('kB')) {
|
||||
scale = 1024;
|
||||
}
|
||||
return Math.floor(parseFloat(sizeText.replace(/[',]/g, '')) * scale);
|
||||
}
|
||||
|
||||
module.exports = { torrent, search, browse, Categories };
|
||||
|
||||
@@ -20,6 +20,10 @@ async function scrape() {
|
||||
// return Promise.all(ids.map(id => limiter.schedule(() => nyaasi.torrent(id)
|
||||
// .then(torrent => processTorrentRecord(torrent)))))
|
||||
// .then(() => console.log(`[${moment()}] finished ${NAME} scrape`));
|
||||
// const queries = ['Sagrada Reset', 'Sakurada Reset'];
|
||||
// return Promise.all(queries.map(query => limiter.schedule(() => nyaasi.search(query)
|
||||
// .then(torrents => Promise.all(torrents.map(torrent => limiter.schedule(() => processTorrentRecord(torrent))))))))
|
||||
// .then(() => console.log(`[${moment()}] finished ${NAME} scrape`));
|
||||
return scrapeLatestTorrents()
|
||||
.then(() => {
|
||||
lastScrape.lastScraped = scrapeStart;
|
||||
|
||||
Reference in New Issue
Block a user