Fixed Gamma scene scraper extracting the wrong scene ID from non-standard URLs.

This commit is contained in:
ThePendulum 2020-03-07 23:40:38 +01:00
parent d6fb9da176
commit 628c5a2013
3 changed files with 8 additions and 15 deletions

View File

@ -18,9 +18,7 @@
:href="href"
:class="{ active: isActive }"
@click="navigate"
>
<Icon icon="stars" /><span class="nav-label">Actors</span>
</a>
>Actors</a>
</router-link>
</li>
@ -34,9 +32,7 @@
:href="href"
:class="{ active: isActive }"
@click="navigate"
>
<Icon icon="earth2" /><span class="nav-label">Networks</span>
</a>
>Networks</a>
</router-link>
</li>
@ -50,9 +46,7 @@
:href="href"
:class="{ active: isActive }"
@click="navigate"
>
<Icon icon="price-tags" /><span class="nav-label">Tags</span>
</a>
>Tags</a>
</router-link>
</li>
</ul>
@ -120,9 +114,8 @@ export default {
.logo {
display: inline-block;
padding: .5rem 1rem;
margin: 0 1rem 0 0;
font-size: 2rem;
padding: 0 0 0 1rem;
margin: 0 .5rem 0 0;
.icon {
width: 6rem;

View File

@ -31,7 +31,7 @@ const routes = [
name: 'scene',
},
{
path: '/movie/:releaseId',
path: '/movie/:releaseId/:releaseSlug?',
component: Release,
name: 'movie',
},

View File

@ -187,7 +187,7 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
});
}
async function scrapeScene(html, url, site, scrapedRelease, mobileHtml) {
async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const m$ = mobileHtml && cheerio.load(mobileHtml, { normalizeWhitespace: true });
const release = { $, url };
@ -198,7 +198,7 @@ async function scrapeScene(html, url, site, scrapedRelease, mobileHtml) {
const [data, data2] = json ? JSON.parse(json) : [];
const videoData = videoJson && JSON.parse(videoJson.slice(videoJson.indexOf('{'), videoJson.indexOf('};') + 1));
[release.entryId] = (scrapedRelease?.path || new URL(url).pathname).split('/').slice(-1);
release.entryId = (baseRelease?.path || new URL(url).pathname).match(/\/(\d{2,})\//)[1];
release.title = videoData?.playerOptions?.sceneInfos.sceneTitle || data?.name;
// date in data object is not the release date of the scene, but the date the entry was added; only use as fallback