[scraper] retrieve latest entries in sequence

This commit is contained in:
TheBeastLT
2020-03-16 10:53:36 +01:00
parent b6e2fceeee
commit b05d4dee33

View File

@@ -1,6 +1,7 @@
const cheerio = require('cheerio');
const needle = require('needle');
const moment = require('moment');
const Promises = require('../../lib/promises');
const defaultUrl = 'https://horriblesubs.info';
const defaultTimeout = 10000;
@@ -33,7 +34,7 @@ async function showData(showInfo, config = {}) {
async function getLatestEntries(config = {}) {
return _getAllLatestEntries(config)
.then((entries) => Promise.all(entries.map((entry) => _findLatestEntry(entry, config))))
.then((entries) => Promises.sequence(entries.map((entry) => () => _findLatestEntry(entry, config))))
.then((entries) => entries.filter((entry) => entry))
}