Scraping Gamma movies. Changed movie detail bar position, and scene detail bar mobile spacing.

This commit is contained in:
DebaucheryLibrarian 2021-01-25 23:01:07 +01:00
parent 41259eae5d
commit dc98fcad5a
5 changed files with 73 additions and 11 deletions

View File

@ -1,5 +1,7 @@
<template>
<div class="tile">
<Details :release="movie" />
<div class="movie">
<router-link
:to="{ name: 'movie', params: { releaseId: movie.id, releaseSlug: movie.slug } }"
@ -50,8 +52,6 @@
</ul>
</div>
</div>
<Details :release="movie" />
</div>
</template>

View File

@ -171,17 +171,11 @@ export default {
*/
.details .favicon {
width: 1.75rem;
padding: .25rem .5rem .25rem .25rem;
}
.date,
.site {
font-size: .75rem;
padding: .35rem .5rem .35rem .5rem;
}
.date {
padding: .25rem .5rem;
padding: .35rem .5rem;
}
.site {

View File

@ -130,6 +130,7 @@ function initReleasesActions(store, router) {
movie(id: $movieId) {
id
title
description
slug
url
date

View File

@ -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,
};

View File

@ -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,