From adc0a6dd71a7a0a3e603b08e92280b61cbba3d80 Mon Sep 17 00:00:00 2001 From: mrcanelas Date: Sat, 11 Sep 2021 11:47:09 -0300 Subject: [PATCH] add configure page --- addon/lib/filter.js | 2 +- beamup.json | 2 +- package-lock.json | 5 +++++ scraper/scheduler/scrapers.js | 2 +- .../animestorrent/animestorrent_api.js | 20 +++++++++---------- scraper/scrapers/darkmahou/darkmahou_api.js | 20 +++++++++---------- .../scrapers/darkmahou/darkmahou_scraper.js | 2 +- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/addon/lib/filter.js b/addon/lib/filter.js index f0db655..265311b 100644 --- a/addon/lib/filter.js +++ b/addon/lib/filter.js @@ -52,7 +52,7 @@ const Providers = { { key: 'animestorrent', label: 'AnimesTorrent', - anime: true + anime: true, foreign: true }, { diff --git a/beamup.json b/beamup.json index c39f45e..622b827 100644 --- a/beamup.json +++ b/beamup.json @@ -1,4 +1,4 @@ { "projectName": "brazuca-torrents", - "lastCommit": "5706813" + "lastCommit": "5f37b49" } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 457dba8..a170f37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -854,6 +854,11 @@ } } }, + "express-rate-limit": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-5.3.0.tgz", + "integrity": "sha512-qJhfEgCnmteSeZAeuOKQ2WEIFTX5ajrzE0xS6gCOBCoRQcU+xEzQmgYQQTpzCcqUAAzTEtu4YEih4pnLfvNtew==" + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", diff --git a/scraper/scheduler/scrapers.js b/scraper/scheduler/scrapers.js index 864645d..bd23856 100644 --- a/scraper/scheduler/scrapers.js +++ b/scraper/scheduler/scrapers.js @@ -35,7 +35,7 @@ module.exports = [ // { scraper: require('../scrapers/thepiratebay/thepiratebay_dump_scraper') } // { scraper: require('../scrapers/thepiratebay/thepiratebay_unofficial_dump_scraper') } // { scraper: require('../scrapers/thepiratebay/thepiratebay_update_size_scraper') } - { scraper: AnimesTorrent, name: AnimesTorrent.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: AnimesTorrent, name: AnimesTorrent.NAME, cron: '0 0 */4 ? * *' }, { scraper: Comando, name: Comando.NAME, cron: '0 0 */4 ? * *' }, { scraper: ComoEuBaixo, name: ComoEuBaixo.NAME, cron: '0 0 */4 ? * *' }, { scraper: DarkMahou, name: DarkMahou.NAME, cron: '0 0 */4 ? * *' }, diff --git a/scraper/scrapers/animestorrent/animestorrent_api.js b/scraper/scrapers/animestorrent/animestorrent_api.js index 8014d66..559924d 100644 --- a/scraper/scrapers/animestorrent/animestorrent_api.js +++ b/scraper/scrapers/animestorrent/animestorrent_api.js @@ -130,17 +130,15 @@ function parseTorrentPage(body) { }); const details = $('div.infox') const torrent = magnets.map((magnetLink) => { - if (magnetLink.includes("magnet")) { - return { - title: decode(magnetLink).name, - original_name: details.find('h1.entry-title').text(), - year: details.find('b:contains(\'Lançamento:\')')[0].nextSibling.nodeValue.trim(), - infoHash: decode(magnetLink).infoHash, - magnetLink: magnetLink, - category: details.find('b:contains(\'Tipo:\')').next().attr('href').split('/')[4], - uploadDate: new Date($("time[itemprop=dateModified]").attr("datetime")), - }; - } + return { + title: decode(magnetLink).name, + original_name: details.find('h1.entry-title').text(), + year: details.find('b:contains(\'Lançamento:\')')[0] ? details.find('b:contains(\'Lançamento:\')')[0].nextSibling.nodeValue.trim() : '', + infoHash: decode(magnetLink).infoHash, + magnetLink: magnetLink, + category: details.find('b:contains(\'Tipo:\')').next().attr('href').split('/')[4], + uploadDate: new Date($("time[itemprop=dateModified]").attr("datetime")), + }; }) resolve(torrent.filter((x) => x)); }); diff --git a/scraper/scrapers/darkmahou/darkmahou_api.js b/scraper/scrapers/darkmahou/darkmahou_api.js index 479a3f0..e45c54e 100644 --- a/scraper/scrapers/darkmahou/darkmahou_api.js +++ b/scraper/scrapers/darkmahou/darkmahou_api.js @@ -131,17 +131,15 @@ function parseTorrentPage(body) { }); const details = $('div.infox') const torrent = magnets.map((magnetLink) => { - if (magnetLink.includes("magnet")) { - return { - title: decode(magnetLink).name, - original_name: details.find('h1.entry-title').text(), - year: details.find('b:contains(\'Lançado:\')')[0].nextSibling.nodeValue, - infoHash: decode(magnetLink).infoHash, - magnetLink: magnetLink, - category: details.find('b:contains(\'Tipo:\')').next().attr('href').split('/')[4], - uploadDate: new Date($("time[itemprop=dateModified]").attr("datetime")), - }; - } + return { + title: decode(magnetLink).name, + original_name: details.find('h1.entry-title').text(), + year: details.find('b:contains(\'Lançado:\')')[0].nextSibling.nodeValue || '', + infoHash: decode(magnetLink).infoHash, + magnetLink: magnetLink, + category: details.find('b:contains(\'Tipo:\')').next().attr('href').split('/')[4], + uploadDate: new Date($("time[itemprop=dateModified]").attr("datetime")), + }; }) resolve(torrent.filter((x) => x)); }); diff --git a/scraper/scrapers/darkmahou/darkmahou_scraper.js b/scraper/scrapers/darkmahou/darkmahou_scraper.js index 5076834..a6f40c4 100644 --- a/scraper/scrapers/darkmahou/darkmahou_scraper.js +++ b/scraper/scrapers/darkmahou/darkmahou_scraper.js @@ -46,7 +46,7 @@ async function scrapeLatestTorrents() { } async function scrapeLatestTorrentsForCategory(category, page = 1) { - console.log(`Scrapping ${NAME} ${category} category page ${page}`); + console.log({Scraper: `Scrapping ${NAME} ${category} category page ${page}`}); return leetx .browse({ category, page }) .catch((error) => {