Insex not fetching video when not required.

This commit is contained in:
DebaucheryLibrarian 2022-03-31 23:01:54 +02:00
parent e9ba02d65d
commit 5352186319
2 changed files with 5 additions and 4 deletions

View File

@ -194,6 +194,7 @@ const { argv } = yargs
alias: 'pics',
})
.option('videos', {
alias: 'video',
describe: 'Include any trailers or teasers',
type: 'boolean',
default: true,

View File

@ -68,7 +68,7 @@ function scrapeLatestLegacy(scenes, site) {
});
}
async function scrapeScene({ query }, url, channel, session) {
async function scrapeScene({ query }, url, channel, parameters, session) {
const release = {};
release.title = query.cnt('.columns div.is-size-5.has-text-weight-bold');
@ -85,7 +85,7 @@ async function scrapeScene({ query }, url, channel, session) {
release.trailer = query.video();
if (!release.trailer) {
if (!release.trailer && parameters.includeTrailers) {
const trailerRes = await http.get(`${channel.url}/api/play-api.php`, { session });
if (trailerRes.ok) {
@ -147,12 +147,12 @@ async function fetchLatestLegacy(site, page = 1) {
return res.status;
}
async function fetchScene(url, site) {
async function fetchScene(url, site, baseRelease, parameters) {
const session = http.session();
const res = await qu.get(url, null, { cookie: 'consent=yes' }, { session });
if (res.ok) {
return scrapeScene(res.item, url, site, session);
return scrapeScene(res.item, url, site, parameters, session);
}
return res.status;