Fixed Nubiles base poster query, handling trailing commas in qu source set. Added profile scene scraper to Dogfart. Added tag photo.

This commit is contained in:
DebaucheryLibrarian
2021-01-11 16:20:01 +01:00
parent e38922f372
commit db4e74fb99
11 changed files with 64 additions and 32 deletions

View File

@@ -253,7 +253,7 @@ function urls(context, selector = 'a', attr = 'href', { origin, protocol = 'http
return attr ? urlEls.map(urlEl => prefixUrl(urlEl, origin, protocol)) : urlEls;
}
function sourceSet(context, selector, attr, options = {}) {
function sourceSet(context, selector, attr = 'srcset', options = {}) {
const srcset = q(context, selector, attr);
if (!srcset) {
@@ -265,11 +265,16 @@ function sourceSet(context, selector, attr, options = {}) {
.map((source) => {
const [link, descriptor] = source.split(' ');
return {
descriptor: descriptor || 'fallback',
url: prefixUrl(link, options.origin, options.protocol),
};
if (link) {
return {
descriptor: descriptor || 'fallback',
url: prefixUrl(link, options.origin, options.protocol),
};
}
return null;
})
.filter(Boolean)
.sort((sourceA, sourceB) => {
if (sourceB.descriptor === 'fallback' || parseInt(sourceA.descriptor, 10) > parseInt(sourceB.descriptor, 10)) {
return -1;