Added partial 'fcuk' (Exploited College Girls) scraper. Added file parameter for actor names and scene URLs.
This commit is contained in:
16
src/utils/file-entries.js
Normal file
16
src/utils/file-entries.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
async function getFileEntries(location) {
|
||||
if (!location) {
|
||||
throw new Error('No filepath provided');
|
||||
}
|
||||
|
||||
const file = await fs.promises.readFile(location, 'utf-8');
|
||||
const entries = file.split(/\n/).map(entry => entry.trim()).filter(Boolean);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
module.exports = getFileEntries;
|
||||
@@ -125,7 +125,7 @@ function date(context, selector, format, match, attr = 'textContent') {
|
||||
return extractDate(dateString, format, match);
|
||||
}
|
||||
|
||||
function image(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
function image(context, selector = 'img', attr, { origin, protocol = 'https' } = {}) {
|
||||
const imageEl = (attr && q(context, selector, attr))
|
||||
|| q(context, selector, 'data-src')
|
||||
|| q(context, selector, 'src');
|
||||
@@ -133,7 +133,7 @@ function image(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
return prefixUrl(imageEl, origin, protocol);
|
||||
}
|
||||
|
||||
function images(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
function images(context, selector = 'img', attr, { origin, protocol = 'https' } = {}) {
|
||||
const attribute = attr
|
||||
|| (q(context, selector, 'data-src') && 'data-src')
|
||||
|| (q(context, selector, 'src') && 'src');
|
||||
@@ -143,31 +143,31 @@ function images(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
return imageEls.map(imageEl => prefixUrl(imageEl, origin, protocol));
|
||||
}
|
||||
|
||||
function url(context, selector = 'a', attr = 'href', origin, protocol = 'https') {
|
||||
function url(context, selector = 'a', attr = 'href', { origin, protocol = 'https' } = {}) {
|
||||
const urlEl = q(context, selector, attr);
|
||||
|
||||
return attr ? prefixUrl(urlEl, origin, protocol) : urlEl;
|
||||
}
|
||||
|
||||
function urls(context, selector = 'a', attr = 'href', origin, protocol = 'https') {
|
||||
function urls(context, selector = 'a', attr = 'href', { origin, protocol = 'https' } = {}) {
|
||||
const urlEls = all(context, selector, attr);
|
||||
|
||||
return attr ? urlEls.map(urlEl => prefixUrl(urlEl, origin, protocol)) : urlEls;
|
||||
}
|
||||
|
||||
function poster(context, selector = 'video', attr = 'poster', origin, protocol = 'https') {
|
||||
function poster(context, selector = 'video', attr = 'poster', { origin, protocol = 'https' } = {}) {
|
||||
const posterEl = q(context, selector, attr);
|
||||
|
||||
return attr ? prefixUrl(posterEl, origin, protocol) : posterEl;
|
||||
}
|
||||
|
||||
function video(context, selector = 'source', attr = 'src', origin, protocol = 'https') {
|
||||
function video(context, selector = 'source', attr = 'src', { origin, protocol = 'https' } = {}) {
|
||||
const trailerEl = q(context, selector, attr);
|
||||
|
||||
return attr ? prefixUrl(trailerEl, origin, protocol) : trailerEl;
|
||||
}
|
||||
|
||||
function videos(context, selector = 'source', attr = 'src', origin, protocol = 'https') {
|
||||
function videos(context, selector = 'source', attr = 'src', { origin, protocol = 'https' } = {}) {
|
||||
const trailerEls = all(context, selector, attr);
|
||||
|
||||
return attr ? trailerEls.map(trailerEl => prefixUrl(trailerEl, origin, protocol)) : trailerEls;
|
||||
|
||||
Reference in New Issue
Block a user