Replaced network and tag files with SQLite database.

This commit is contained in:
2019-03-25 03:57:33 +01:00
parent f44c5083ff
commit 4d7f323e86
22 changed files with 1948 additions and 654 deletions

View File

@@ -4,6 +4,8 @@ const bhttp = require('bhttp');
const cheerio = require('cheerio');
const moment = require('moment');
const { matchTags } = require('../tags');
const tagMap = {
'3+ on 1': 'gangbang',
anal: 'anal',
@@ -52,7 +54,7 @@ function scrapeLatest(html, site) {
});
}
function scrapeScene(html, url, site) {
async function scrapeScene(html, url, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const originalTitle = $('h1.watchpage-title').text().trim();
@@ -68,7 +70,7 @@ function scrapeScene(html, url, site) {
const duration = moment.duration($('span[title="Runtime"]').text().trim()).asSeconds();
const rawTags = $(tagsElement).find('a').map((tagIndex, tagElement) => $(tagElement).text()).toArray();
const tags = rawTags.reduce((accTags, tag) => (tagMap[tag] ? [...accTags, tagMap[tag]] : accTags), []);
const tags = await matchTags(rawTags);
return {
url,