Added Little Caprice Dreams scraped (WIP).

This commit is contained in:
DebaucheryLibrarian
2020-11-23 04:32:56 +01:00
parent eae9ee3cbe
commit 711a9441a6
40 changed files with 126 additions and 5 deletions

View File

@@ -3,8 +3,9 @@
const { JSDOM } = require('jsdom');
const moment = require('moment');
const http = require('./http');
const virtualConsole = require('./virtual-console')(__filename);
const { window: globalWindow } = new JSDOM('');
const { window: globalWindow } = new JSDOM('', { virtualConsole });
function trim(str) {
if (typeof str !== 'string') {
@@ -440,7 +441,7 @@ function initAll(context, selector, window) {
}
function extract(htmlValue, selector) {
const { window } = new JSDOM(htmlValue);
const { window } = new JSDOM(htmlValue, { virtualConsole });
if (selector) {
return init(window.document.querySelector(selector), window);
@@ -450,7 +451,7 @@ function extract(htmlValue, selector) {
}
function extractAll(htmlValue, selector) {
const { window } = new JSDOM(htmlValue);
const { window } = new JSDOM(htmlValue, { virtualConsole });
return initAll(window.document, selector, window);
}