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

@@ -3,31 +3,9 @@
const bhttp = require('bhttp');
const cheerio = require('cheerio');
const moment = require('moment');
const { kink } = require('../networks');
const tagMap = {
Airtight: 'airtight',
Anal: 'anal',
Asian: 'asian',
BDSM: 'BDSM',
Blowbang: 'blowbang',
Blowjob: 'blowjob',
Bondage: 'bondage',
Choking: 'choking',
'Corporal Punishment': 'corporal punishment',
'Double Penetration': 'DP',
Gangbang: 'gangbang',
'High Heels': 'high heels',
Petite: 'petite',
'Role Play': 'roleplay',
'Rope Bondage': 'bondage',
'Rough Sex': 'rough',
Shaved: 'shaved',
Slapping: 'slapping',
'Small Tits': 'small boobs',
Squirting: 'squirting',
White: 'white',
};
const knex = require('../knex');
const { matchTags } = require('../tags');
function scrapeLatest(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
@@ -71,7 +49,6 @@ async function scrapeScene(html, url, id, ratingRes, site) {
const actorsRaw = $('.shoot-info p.starring');
const sitename = $('.shoot-logo a').attr('href').split('/')[2];
const channelSite = kink.sites[sitename];
const date = moment.utc($(actorsRaw)
.prev()
@@ -87,7 +64,9 @@ async function scrapeScene(html, url, id, ratingRes, site) {
const { average: stars } = ratingRes.body;
const rawTags = $('.tag-list > a[href*="/tag"]').map((tagIndex, tagElement) => $(tagElement).text()).toArray();
const tags = rawTags.reduce((accTags, tag) => (tagMap[tag] ? [...accTags, tagMap[tag]] : accTags), []);
const channelSite = await knex('sites').where({ id: sitename }).first();
const tags = await matchTags(rawTags);
return {
url,