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,35 +4,7 @@ const bhttp = require('bhttp');
const cheerio = require('cheerio');
const moment = require('moment');
const tagMap = {
Anal: 'anal',
'Ass Licking': 'ass licking',
'Ass To Mouth': 'ATM',
'Big Ass': 'big butt',
'Big Tits': 'big boobs',
Black: 'big black cock',
Blonde: 'blonde',
Blowjob: 'blowjob',
'Blowjob (double)': 'double blowjob',
Brunette: 'brunette',
'Cum Swallowing': 'swallowing',
Cumshot: 'cumshot',
Deepthroat: 'deepthroat',
'Double Penetration (DP)': 'DP',
Ebony: 'ebony',
Facial: 'facial',
Gangbang: 'gangbang',
Gonzo: 'gonzo',
Hardcore: 'hardcore',
Interracial: 'interracial',
Latina: 'latina',
Petite: 'petite',
'Pussy Licking': 'pussy licking',
Rimjob: 'ass licking',
'Rough Sex': 'rough',
'Small Tits': 'small boobs',
Threesome: 'threesome',
};
const { matchTags } = require('../tags');
function scrape(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
@@ -69,7 +41,7 @@ function scrape(html, site) {
});
}
function scrapeSceneFallback($, url, site) {
async function scrapeSceneFallback($, url, site) {
const title = $('h1.title').text();
const date = moment.utc($('.updatedDate').text(), 'MM-DD-YYYY').toDate();
const actors = $('.sceneColActors a').map((actorIndex, actorElement) => $(actorElement).text()).toArray();
@@ -78,7 +50,7 @@ function scrapeSceneFallback($, url, site) {
const stars = $('.currentRating').text().split('/')[0] / 2;
const rawTags = $('.sceneColCategories > 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,
@@ -94,7 +66,7 @@ function scrapeSceneFallback($, url, site) {
};
}
function scrapeScene(html, url, site) {
async function scrapeScene(html, url, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const json = $('script[type="application/ld+json"]').html();
@@ -122,7 +94,7 @@ function scrapeScene(html, url, site) {
const duration = moment.duration(data.duration.slice(2).split(':')).asSeconds();
const rawTags = data.keywords.split(', ');
const tags = rawTags.reduce((accTags, tag) => (tagMap[tag] ? [...accTags, tagMap[tag]] : accTags), []);
const tags = await matchTags(rawTags);
return {
url,