Added support for upcoming scenes to Bang scraper.

This commit is contained in:
DebaucheryLibrarian 2020-11-26 22:07:54 +01:00
parent 4e559f63e3
commit 60485751e2
1 changed files with 66 additions and 0 deletions

View File

@ -263,6 +263,71 @@ async function fetchLatest(site, page = 1) {
return scrapeAll(res.body.hits.hits, site);
}
async function fetchUpcoming(site, page = 1) {
const res = await http.post(`https://${clusterId}.us-east-1.aws.found.io/videos/video/_search`, {
size: 50,
from: (page - 1) * 50,
query: {
bool: {
must: [
{
match: {
status: 'ok',
},
},
{
range: {
releaseDate: {
lte: 'now+7d',
},
},
},
{
nested: {
path: 'series',
query: {
bool: {
must: [
{
match: {
'series.id': {
operator: 'AND',
query: site.parameters.siteId,
},
},
},
],
},
},
},
},
],
must_not: [
{
match: {
type: 'trailer',
},
},
],
},
},
sort: [
{
releaseDate: {
order: 'desc',
},
},
],
}, {
encodeJSON: true,
headers: {
Authorization: `Basic ${authKey}`,
},
});
return scrapeAll(res.body.hits.hits, site);
}
async function fetchScene(url) {
const encodedId = new URL(url).pathname.split('/')[2];
const entryId = decodeId(encodedId);
@ -327,4 +392,5 @@ module.exports = {
fetchLatest,
fetchProfile,
fetchScene,
fetchUpcoming,
};