Scraping Gamma movies. Changed movie detail bar position, and scene detail bar mobile spacing.
This commit is contained in:
parent
41259eae5d
commit
dc98fcad5a
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="tile">
|
<div class="tile">
|
||||||
|
<Details :release="movie" />
|
||||||
|
|
||||||
<div class="movie">
|
<div class="movie">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: 'movie', params: { releaseId: movie.id, releaseSlug: movie.slug } }"
|
:to="{ name: 'movie', params: { releaseId: movie.id, releaseSlug: movie.slug } }"
|
||||||
|
@ -50,8 +52,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Details :release="movie" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -171,17 +171,11 @@ export default {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.details .favicon {
|
.details .favicon {
|
||||||
width: 1.75rem;
|
padding: .35rem .5rem .35rem .5rem;
|
||||||
padding: .25rem .5rem .25rem .25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.date,
|
|
||||||
.site {
|
|
||||||
font-size: .75rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
padding: .25rem .5rem;
|
padding: .35rem .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site {
|
.site {
|
||||||
|
|
|
@ -130,6 +130,7 @@ function initReleasesActions(store, router) {
|
||||||
movie(id: $movieId) {
|
movie(id: $movieId) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
description
|
||||||
slug
|
slug
|
||||||
url
|
url
|
||||||
date
|
date
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { fetchApiLatest, fetchApiUpcoming, fetchScene, fetchApiProfile } = require('./gamma');
|
const { fetchApiLatest, fetchApiUpcoming, fetchScene, fetchMovie, fetchApiProfile } = require('./gamma');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
fetchLatest: fetchApiLatest,
|
fetchLatest: fetchApiLatest,
|
||||||
fetchProfile: fetchApiProfile,
|
fetchProfile: fetchApiProfile,
|
||||||
fetchScene,
|
fetchScene,
|
||||||
|
fetchMovie,
|
||||||
fetchUpcoming: fetchApiUpcoming,
|
fetchUpcoming: fetchApiUpcoming,
|
||||||
};
|
};
|
||||||
|
|
|
@ -320,6 +320,57 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
|
||||||
return release;
|
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) {
|
function scrapeActorSearch(html, url, actorName) {
|
||||||
const { document } = new JSDOM(html).window;
|
const { document } = new JSDOM(html).window;
|
||||||
const actorLink = document.querySelector(`a[title="${actorName}" i]`);
|
const actorLink = document.querySelector(`a[title="${actorName}" i]`);
|
||||||
|
@ -575,6 +626,20 @@ async function fetchScene(url, site, baseRelease) {
|
||||||
return null;
|
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) {
|
async function fetchActorScenes(actorName, apiUrl, siteSlug) {
|
||||||
const res = await http.post(apiUrl, {
|
const res = await http.post(apiUrl, {
|
||||||
requests: [
|
requests: [
|
||||||
|
@ -668,6 +733,7 @@ module.exports = {
|
||||||
fetchApiProfile,
|
fetchApiProfile,
|
||||||
fetchApiUpcoming,
|
fetchApiUpcoming,
|
||||||
fetchLatest,
|
fetchLatest,
|
||||||
|
fetchMovie,
|
||||||
fetchProfile,
|
fetchProfile,
|
||||||
fetchScene,
|
fetchScene,
|
||||||
fetchUpcoming,
|
fetchUpcoming,
|
||||||
|
|
Loading…
Reference in New Issue