Added Gamma movie API scraper.

This commit is contained in:
DebaucheryLibrarian 2022-02-02 23:51:15 +01:00
parent 0b7e0319f1
commit f1a7f2f905
18 changed files with 71 additions and 40 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -10922,16 +10922,17 @@ const sites = [
parent: 'zerotolerance',
parameters: {
scene: 'https://www.addicted2girls.com/en/video/addicted2girls',
movie: 'https://www.addicted2girls.com/en/dvd',
},
},
{
slug: 'genderx',
name: 'GenderX',
url: 'https://www.genderx.com',
slug: 'genderxfilms',
name: 'GenderXFilms',
url: 'https://www.genderxfilms.com',
tags: ['transsexual'],
parent: 'zerotolerance',
parameters: {
scene: 'https://www.genderx.com/en/video',
movie: 'https://www.genderxfilms.com/en/dvd',
},
},
{
@ -10939,6 +10940,9 @@ const sites = [
name: 'Zero Tolerance Films',
url: 'https://www.zerotolerancefilms.com',
parent: 'zerotolerance',
parameters: {
scene: 'https://www.zerotolerancefilms.com/en/video/zerotolerancefilms',
},
},
];

View File

@ -200,6 +200,18 @@ async function getPhotosApi(entryId, site, parameters) {
return photos.concat(thumbs.slice(photos.length));
}
function getImageSources(source) {
return [
`https://images-fame.gammacdn.com/movies${source}`,
`https://images01-fame.gammacdn.com/movies${source}`,
`https://images02-fame.gammacdn.com/movies${source}`,
`https://images03-fame.gammacdn.com/movies${source}`,
`https://images04-fame.gammacdn.com/movies${source}`,
`https://images-evilangel.gammacdn.com/movies${source}`,
`https://transform.gammacdn.com/movies${source}`,
];
}
async function scrapeApiReleases(json, site) {
return json.map((scene) => {
if (site.parameters?.extract && scene.sitename !== site.parameters.extract) {
@ -402,13 +414,14 @@ async function scrapeScene({ query }, url, channel, baseRelease, mobileItem, opt
return release;
}
async function scrapeSceneApi(data, site, options) {
async function scrapeReleaseApi(data, site, options) {
const release = {};
release.entryId = data.clip_id;
release.entryId = data.clip_id || data.movie_id;
release.title = data.title;
release.duration = data.length;
release.date = new Date(data.date * 1000) || qu.parseDate(data.release_date, 'YYYY-MM-DD');
release.date = (data.date && new Date(data.date * 1000)) || qu.parseDate(data.release_date || data.last_modified, 'YYYY-MM-DD');
release.director = data.directors[0]?.name || null;
release.actors = data.actors.map((actor) => ({
entryId: actor.actor_id,
@ -423,33 +436,9 @@ async function scrapeSceneApi(data, site, options) {
if (data.pictures) {
release.poster = [
...(data.pictures['1920x1080'] ? [
`https://images-fame.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images01-fame.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images02-fame.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images03-fame.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images04-fame.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures['1920x1080']}`,
`https://transform.gammacdn.com/movies${data.pictures['1920x1080']}`,
] : []),
...(data.pictures.resized ? [
`https://images-fame.gammacdn.com/movies${data.pictures.resized}`,
`https://images01-fame.gammacdn.com/movies${data.pictures.resized}`,
`https://images02-fame.gammacdn.com/movies${data.pictures.resized}`,
`https://images03-fame.gammacdn.com/movies${data.pictures.resized}`,
`https://images04-fame.gammacdn.com/movies${data.pictures.resized}`,
`https://images-evilangel.gammacdn.com/movies${data.pictures.resized}`,
`https://transform.gammacdn.com/movies${data.pictures.resized}`,
] : []),
...(data.pictures['960x544'] ? [
`https://images-fame.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://images01-fame.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://images02-fame.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://images03-fame.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://images04-fame.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://images-evilangel.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
`https://transform.gammacdn.com/movies${data.pictures['960x544']}?width=1950`,
] : []),
...(data.pictures['1920x1080'] ? getImageSources(data.pictures['1920x1080']) : []),
...(data.pictures.resized ? getImageSources(data.pictures.resized) : []),
...(data.pictures['960x544'] ? getImageSources(data.pictures['960x544']) : []),
];
}
@ -457,15 +446,22 @@ async function scrapeSceneApi(data, site, options) {
release.photos = await getPhotosApi(data.photoset_id, site, options.parameters);
}
if (data.cover_path) {
release.covers = [
getImageSources(`/${data.cover_path}_front_400x625.jpg?width=450&height=636&format=webp`),
getImageSources(`/${data.cover_path}_back_400x625.jpg?width=450&height=636&format=webp`),
];
}
if (data.trailers) {
release.trailer = Object.entries(data.trailers).map(([quality, source]) => ({ src: source, quality }));
}
if (data.movie_id) {
if (data.movie_id && !data.movie_path) {
release.movie = {
entryId: data.movie_id,
title: data.movie_title,
url: qu.prefixUrl(`/en/movie/${data.url_movie_title}/${data.movie_id}`, site.url),
url: qu.prefixUrl(`${data.url_movie_title}/${data.movie_id}`, options.parameters.movie ? options.parameters.movie : `${site.url}/en/movie`),
};
}
@ -642,8 +638,6 @@ async function fetchLatestApi(site, page = 1, preData, include, upcoming = false
encodeJSON: true,
});
console.log(res.body.results);
if (res.status === 200 && res.body.results?.[0]?.hits) {
return scrapeApiReleases(res.body.results[0].hits, site);
}
@ -681,7 +675,39 @@ async function fetchSceneApi(url, site, baseRelease, options) {
});
if (res.status === 200 && res.body.results?.[0]?.hits) {
return scrapeSceneApi(res.body.results[0].hits[0], site, options);
return scrapeReleaseApi(res.body.results[0].hits[0], site, options);
}
return res.status;
}
async function fetchMovieApi(url, site, baseRelease, options) {
const referer = options.parameters?.referer || `${site.parameters?.networkReferer ? site.parent.url : site.url}/en/movies`;
const { apiUrl } = await fetchApiCredentials(referer, site);
const entryId = (baseRelease?.path || new URL(url).pathname).match(/\/(\d{2,})(\/|$)/)?.[1];
const res = await http.post(apiUrl, {
requests: [
{
indexName: 'all_movies',
params: `query=&page=0&facets=[]&tagFilters=&facetFilters=[["movie_id:${entryId}"]]`,
},
{
indexName: 'all_movies',
params: 'query=&page=0&hitsPerPage=1&attributesToRetrieve=[]&attributesToHighlight=[]&attributesToSnippet=[]&tagFilters=&analytics=false&clickAnalytics=false&facets=clip_id',
},
],
}, {
headers: {
Referer: referer,
},
}, {
encodeJSON: true,
});
if (res.status === 200 && res.body.results?.[0]?.hits) {
return scrapeReleaseApi(res.body.results[0].hits[0], site, options);
}
return res.status;
@ -894,7 +920,8 @@ module.exports = {
fetchProfile: fetchApiProfile,
// fetchScene,
fetchScene: fetchSceneApi,
scrapeMovie,
// scrapeMovie,
fetchMovie: fetchMovieApi,
},
getPhotos,
scrapeApiProfile,