Scraping Gamma movies. Changed movie detail bar position, and scene detail bar mobile spacing.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { fetchApiLatest, fetchApiUpcoming, fetchScene, fetchApiProfile } = require('./gamma');
|
||||
const { fetchApiLatest, fetchApiUpcoming, fetchScene, fetchMovie, fetchApiProfile } = require('./gamma');
|
||||
|
||||
module.exports = {
|
||||
fetchLatest: fetchApiLatest,
|
||||
fetchProfile: fetchApiProfile,
|
||||
fetchScene,
|
||||
fetchMovie,
|
||||
fetchUpcoming: fetchApiUpcoming,
|
||||
};
|
||||
|
||||
@@ -320,6 +320,57 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
|
||||
return release;
|
||||
}
|
||||
|
||||
async function fetchMovieTrailer(release) {
|
||||
if (!release.entryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const url = `https://www.evilangel.com/en/dvdtrailer/${release.entryId}`;
|
||||
const res = await qu.get(url);
|
||||
|
||||
if (!res.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const trailerHost = res.html.match(/"host":\s*"(.*\.com)"/)?.[1].replace(/\\\//g, '/');
|
||||
const trailerPath = res.html.match(/"url":\s*"(.*\.mp4)"/)?.[1].replace(/\\\//g, '/');
|
||||
|
||||
if (trailerHost && trailerPath) {
|
||||
return qu.prefixUrl(trailerPath, trailerHost);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function scrapeMovie({ query, html }, window, url, entity, options) {
|
||||
const release = {};
|
||||
const data = window.dataLayer[0]?.dvdDetails;
|
||||
|
||||
// const options = html.match(/options = {.*};/);
|
||||
|
||||
release.entryId = new URL(url).pathname.match(/\/(\d+)(\/|$)/)?.[1];
|
||||
|
||||
release.covers = [
|
||||
query.img('.frontCoverImg', 'href'),
|
||||
query.img('.backCoverImg', 'href'),
|
||||
];
|
||||
|
||||
release.description = query.cnt('.descriptionText');
|
||||
release.date = qu.extractDate(data.dvdReleaseDate);
|
||||
release.title = data.dvdName;
|
||||
|
||||
release.actors = data.dvdActors.map(actor => ({ name: actor.actorName, entryId: actor.actorId }));
|
||||
release.tags = query.cnts('.dvdCol a');
|
||||
|
||||
release.scenes = scrapeAll(html, entity, entity.url);
|
||||
|
||||
if (options.includeTrailers) {
|
||||
release.trailer = await fetchMovieTrailer(release);
|
||||
}
|
||||
|
||||
return release;
|
||||
}
|
||||
|
||||
function scrapeActorSearch(html, url, actorName) {
|
||||
const { document } = new JSDOM(html).window;
|
||||
const actorLink = document.querySelector(`a[title="${actorName}" i]`);
|
||||
@@ -575,6 +626,20 @@ async function fetchScene(url, site, baseRelease) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchMovie(url, channel, baseRelease, options) {
|
||||
const res = await qu.get(url, null, null, {
|
||||
extract: {
|
||||
runScripts: 'dangerously',
|
||||
},
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
return scrapeMovie(res.item, res.window, url, channel, options);
|
||||
}
|
||||
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchActorScenes(actorName, apiUrl, siteSlug) {
|
||||
const res = await http.post(apiUrl, {
|
||||
requests: [
|
||||
@@ -668,6 +733,7 @@ module.exports = {
|
||||
fetchApiProfile,
|
||||
fetchApiUpcoming,
|
||||
fetchLatest,
|
||||
fetchMovie,
|
||||
fetchProfile,
|
||||
fetchScene,
|
||||
fetchUpcoming,
|
||||
|
||||
Reference in New Issue
Block a user