Updated unprint for interface and user agent control. Using request interface in Nubiles, fixed relative album path.
This commit is contained in:
parent
5ce3d79e49
commit
b67824969f
|
|
@ -93,7 +93,7 @@
|
||||||
"tunnel": "0.0.6",
|
"tunnel": "0.0.6",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"undici": "^5.28.1",
|
"undici": "^5.28.1",
|
||||||
"unprint": "^0.18.1",
|
"unprint": "^0.18.4",
|
||||||
"url-pattern": "^1.0.3",
|
"url-pattern": "^1.0.3",
|
||||||
"v-tooltip": "^2.1.3",
|
"v-tooltip": "^2.1.3",
|
||||||
"video.js": "^8.6.1",
|
"video.js": "^8.6.1",
|
||||||
|
|
@ -20340,9 +20340,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unprint": {
|
"node_modules/unprint": {
|
||||||
"version": "0.18.1",
|
"version": "0.18.4",
|
||||||
"resolved": "https://registry.npmjs.org/unprint/-/unprint-0.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/unprint/-/unprint-0.18.4.tgz",
|
||||||
"integrity": "sha512-lL7aIQfVoVY3oC69WM6GOUabwfJkMQxM4XfIT5EA21CsisJassWU3sX2ZQqIrsX4NujOeDVgzU2qYFJ/QWpoqQ==",
|
"integrity": "sha512-npOTOoKrnxv+Zs7AFz3pXfyV7VftRr0ULAhCbnodPNvBoymde9JnVuRGJ6JL6q6RfH0wJgO5jpsT1ar844733g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bottleneck": "^2.19.5",
|
"bottleneck": "^2.19.5",
|
||||||
"cookie": "^1.1.1",
|
"cookie": "^1.1.1",
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@
|
||||||
"tunnel": "0.0.6",
|
"tunnel": "0.0.6",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"undici": "^5.28.1",
|
"undici": "^5.28.1",
|
||||||
"unprint": "^0.18.1",
|
"unprint": "^0.18.4",
|
||||||
"url-pattern": "^1.0.3",
|
"url-pattern": "^1.0.3",
|
||||||
"v-tooltip": "^2.1.3",
|
"v-tooltip": "^2.1.3",
|
||||||
"video.js": "^8.6.1",
|
"video.js": "^8.6.1",
|
||||||
|
|
|
||||||
10
src/app.js
10
src/app.js
|
|
@ -32,13 +32,9 @@ let done = false;
|
||||||
|
|
||||||
unprint.options({
|
unprint.options({
|
||||||
timeout: argv.requestTimeout,
|
timeout: argv.requestTimeout,
|
||||||
headers: {
|
userAgent: 'traxxx',
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
|
browserUserAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
|
||||||
},
|
apiUserAgent: 'traxxx',
|
||||||
context: {
|
|
||||||
// browser requests
|
|
||||||
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
|
|
||||||
},
|
|
||||||
limits: {
|
limits: {
|
||||||
...config.limits,
|
...config.limits,
|
||||||
default: {
|
default: {
|
||||||
|
|
|
||||||
|
|
@ -65,11 +65,11 @@ async function fetchLatest(channel, page = 1, { parameters }) {
|
||||||
const provider = new URL(channel.url).searchParams.get('providers');
|
const provider = new URL(channel.url).searchParams.get('providers');
|
||||||
|
|
||||||
const res = await unprint.get(`${parameters.api}/videos?filter[provider]=${provider}&limit=24&sources=${parameters.source}&page=${page}`, {
|
const res = await unprint.get(`${parameters.api}/videos?filter[provider]=${provider}&limit=24&sources=${parameters.source}&page=${page}`, {
|
||||||
|
interface: 'request',
|
||||||
headers: {
|
headers: {
|
||||||
// currently only required for Bellesa Plus
|
// currently only required for Bellesa Plus
|
||||||
Referer: `${new URL(channel.url).origin}/videos`,
|
Referer: `${new URL(channel.url).origin}/videos`,
|
||||||
Cookie: 'bellesa_agegate=true',
|
Cookie: 'bellesa_agegate=true',
|
||||||
'User-Agent': null,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ function stripQuery(link) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPhotos(albumUrl) {
|
async function getPhotos(albumUrl) {
|
||||||
const res = await unprint.get(albumUrl, { selectAll: '.photo-thumb' });
|
const res = await unprint.get(albumUrl, {
|
||||||
|
selectAll: '.photo-thumb',
|
||||||
|
interface: 'request',
|
||||||
|
});
|
||||||
|
|
||||||
return res.ok
|
return res.ok
|
||||||
? res.context.map(({ query }) => unprint.prefixUrl(query.element('source').srcset))
|
? res.context.map(({ query }) => unprint.prefixUrl(query.element('source').srcset))
|
||||||
|
|
@ -65,8 +68,12 @@ function scrapeAll(scenes, entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchLatest(site, page = 1) {
|
async function fetchLatest(site, page = 1) {
|
||||||
const url = `${site.url}/video/gallery/${(page - 1) * 12}`;
|
const url = `${site.url}/video/gallery/${((page - 1) * 12) || ''}`;
|
||||||
const res = await unprint.get(url, { selectAll: '.content-grid-item' });
|
|
||||||
|
const res = await unprint.get(url, {
|
||||||
|
interface: 'request',
|
||||||
|
selectAll: '.content-grid-item',
|
||||||
|
});
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
return scrapeAll(res.context, site);
|
return scrapeAll(res.context, site);
|
||||||
|
|
@ -78,7 +85,11 @@ async function fetchLatest(site, page = 1) {
|
||||||
async function fetchUpcoming(site) {
|
async function fetchUpcoming(site) {
|
||||||
if (site.parameters?.upcoming) {
|
if (site.parameters?.upcoming) {
|
||||||
const url = `${site.url}/video/upcoming`;
|
const url = `${site.url}/video/upcoming`;
|
||||||
const res = await unprint.get(url, { selectAll: '.content-grid-item' });
|
|
||||||
|
const res = await unprint.get(url, {
|
||||||
|
selectAll: '.content-grid-item',
|
||||||
|
interface: 'request',
|
||||||
|
});
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
return scrapeAll(res.context, site);
|
return scrapeAll(res.context, site);
|
||||||
|
|
@ -121,12 +132,24 @@ async function scrapeScene({ query }, { url, entity, include }) {
|
||||||
const albumLink = query.url('.content-pane-related-links a[href*="gallery"]');
|
const albumLink = query.url('.content-pane-related-links a[href*="gallery"]');
|
||||||
|
|
||||||
if (albumLink && include.photos) {
|
if (albumLink && include.photos) {
|
||||||
release.photos = await getPhotos(albumLink);
|
release.photos = await getPhotos(unprint.prefixUrl(albumLink, new URL(entity.url).origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchScene(url, entity, _baseRelease, include) {
|
||||||
|
const res = await unprint.get(url, {
|
||||||
|
interface: 'request',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
return scrapeScene(res.context, { url, entity, include });
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status;
|
||||||
|
}
|
||||||
|
|
||||||
function scrapeProfile({ query }, avatar) {
|
function scrapeProfile({ query }, avatar) {
|
||||||
const profile = {};
|
const profile = {};
|
||||||
|
|
||||||
|
|
@ -161,7 +184,10 @@ async function findModel(actor, entity) {
|
||||||
const origin = slugUrlMap[entity.slug] || entity.url;
|
const origin = slugUrlMap[entity.slug] || entity.url;
|
||||||
|
|
||||||
const url = `${origin}/model/alpha/${firstLetter}`;
|
const url = `${origin}/model/alpha/${firstLetter}`;
|
||||||
const resModels = await unprint.get(url);
|
|
||||||
|
const resModels = await unprint.get(url, {
|
||||||
|
interface: 'request',
|
||||||
|
});
|
||||||
|
|
||||||
if (!resModels.ok) {
|
if (!resModels.ok) {
|
||||||
return resModels.status;
|
return resModels.status;
|
||||||
|
|
@ -191,7 +217,9 @@ async function fetchProfile(actor, { entity }) {
|
||||||
const model = await findModel(actor, entity);
|
const model = await findModel(actor, entity);
|
||||||
|
|
||||||
if (model) {
|
if (model) {
|
||||||
const resModel = await unprint.get(model.url);
|
const resModel = await unprint.get(model.url, {
|
||||||
|
interface: 'request',
|
||||||
|
});
|
||||||
|
|
||||||
if (resModel.ok) {
|
if (resModel.ok) {
|
||||||
return scrapeProfile(resModel.context, model.avatar);
|
return scrapeProfile(resModel.context, model.avatar);
|
||||||
|
|
@ -207,5 +235,5 @@ module.exports = {
|
||||||
fetchLatest,
|
fetchLatest,
|
||||||
fetchUpcoming,
|
fetchUpcoming,
|
||||||
fetchProfile,
|
fetchProfile,
|
||||||
scrapeScene,
|
fetchScene,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue