Completed Perv City scraper. Outputting results as list.

This commit is contained in:
2019-03-04 04:19:03 +01:00
parent 5e4e12fbf8
commit af9565b296
7 changed files with 77 additions and 18 deletions

View File

@@ -2,7 +2,7 @@
const bhttp = require('bhttp');
const cheerio = require('cheerio');
const { parse, startOfDay } = require('date-fns');
const moment = require('moment');
function scrape(html, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
@@ -22,7 +22,7 @@ function scrape(html, site) {
.map((actorIndex, actorElement) => $(actorElement).attr('title'))
.toArray();
const date = startOfDay(parse($(element).find('.sceneDate').text(), 'MM-DD-YYYY'));
const date = moment.utc($(element).find('.sceneDate').text(), 'MM-DD-YYYY').toDate();
return {
url,
@@ -34,6 +34,7 @@ function scrape(html, site) {
dislikes,
stars,
},
siteId: site.id,
};
});
}