Separated actor expand buttons. Refactored Brazzers scraper. Fixed actor releases not included in shallow scrape. Added number query and data-src default to qu img. Updated README. Removed post-install migrate and seed.
This commit is contained in:
@@ -103,6 +103,12 @@ function text(context, selector, applyTrim = true) {
|
||||
return applyTrim ? trim(textValue) : textValue;
|
||||
}
|
||||
|
||||
function number(context, selector, attr = true) {
|
||||
const value = q(context, selector, attr);
|
||||
|
||||
return value ? Number(value) : null;
|
||||
}
|
||||
|
||||
function meta(context, selector, attrArg = 'content', applyTrim = true) {
|
||||
if (/meta\[.*\]/.test(selector)) {
|
||||
return q(context, selector, attrArg, applyTrim);
|
||||
@@ -119,17 +125,22 @@ function date(context, selector, format, match, attr = 'textContent') {
|
||||
return extractDate(dateString, format, match);
|
||||
}
|
||||
|
||||
function image(context, selector = 'img', attr = 'src', origin, protocol = 'https') {
|
||||
const imageEl = q(context, selector, attr);
|
||||
function image(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
const imageEl = (attr && q(context, selector, attr))
|
||||
|| q(context, selector, 'src')
|
||||
|| q(context, selector, 'data-src');
|
||||
|
||||
// no attribute means q output will be HTML element
|
||||
return attr ? prefixUrl(imageEl, origin, protocol) : imageEl;
|
||||
return prefixUrl(imageEl, origin, protocol);
|
||||
}
|
||||
|
||||
function images(context, selector = 'img', attr = 'src', origin, protocol = 'https') {
|
||||
const imageEls = all(context, selector, attr);
|
||||
function images(context, selector = 'img', attr, origin, protocol = 'https') {
|
||||
const attribute = attr
|
||||
|| (q(context, selector, 'src') && 'src')
|
||||
|| (q(context, selector, 'data-src') && 'data-src');
|
||||
|
||||
return attr ? imageEls.map(imageEl => prefixUrl(imageEl, origin, protocol)) : imageEls;
|
||||
const imageEls = all(context, selector, attribute);
|
||||
|
||||
return imageEls.map(imageEl => prefixUrl(imageEl, origin, protocol));
|
||||
}
|
||||
|
||||
function url(context, selector = 'a', attr = 'href', origin, protocol = 'https') {
|
||||
@@ -225,6 +236,8 @@ const quFuncs = {
|
||||
imgs: images,
|
||||
length: duration,
|
||||
meta,
|
||||
number,
|
||||
num: number,
|
||||
poster,
|
||||
q,
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user