adds kitsu mapping for horrible subs WIP

This commit is contained in:
TheBeastLT
2019-12-30 18:35:02 +01:00
parent e7f46d2adc
commit a73cdb6b54
5 changed files with 10525 additions and 14 deletions

View File

@@ -40,8 +40,11 @@ async function getLatestEntries(config = {}) {
function _getContent(endpoint, config = {},) {
const baseUrl = config.proxyUrl || defaultUrl;
const timeout = config.timeout || defaultTimeout;
const url = endpoint.startsWith('http')
? endpoint.replace(/https?:\/\/[^/]+/, baseUrl)
: `${baseUrl}${endpoint}`;
return needle('get', `${baseUrl}${endpoint}`, { open_timeout: timeout, follow: 2 })
return needle('get', url, { open_timeout: timeout, follow: 2 })
.then((response) => response.body)
.then((body) => cheerio.load(body));
}
@@ -115,5 +118,5 @@ function _parseDate(date) {
return moment(date, 'MM/DD/YYYY').toDate();
}
module.exports = { allShows, showData, getLatestEntries };
module.exports = { allShows, showData, getLatestEntries, _getShowId };