From 6baa6b080254691e083478c47b96936b8c385365 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 28 Dec 2020 01:29:34 +0100 Subject: [PATCH] Fixed fallback create dates in scene tiles. Fixed Mike Adriano entryIds and trailers for Nympho. --- assets/components/releases/tile-details.vue | 3 +-- src/scrapers/mikeadriano.js | 22 ++++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/assets/components/releases/tile-details.vue b/assets/components/releases/tile-details.vue index c5b4b469..26ee1d17 100644 --- a/assets/components/releases/tile-details.vue +++ b/assets/components/releases/tile-details.vue @@ -48,12 +48,11 @@ {{ `(${formatDate(release.dateAdded, 'MMMM D, YYYY')})` }} + >{{ `(${formatDate(release.createdAt, 'MMMM D, YYYY')})` }} diff --git a/src/scrapers/mikeadriano.js b/src/scrapers/mikeadriano.js index 0cf35c0d..f11142c0 100644 --- a/src/scrapers/mikeadriano.js +++ b/src/scrapers/mikeadriano.js @@ -2,7 +2,7 @@ const qu = require('../utils/qu'); -async function scrapeAll(scenes) { +function scrapeAll(scenes) { return scenes.map(({ query }) => { const release = { director: 'Mike Adriano', @@ -11,7 +11,8 @@ async function scrapeAll(scenes) { release.title = query.cnt('h3.title a, .content-title-wrap a'); release.url = query.url('h3.title a, .content-title-wrap a'); - release.entryId = new URL(release.url).pathname.match(/\/view\/(\d+)/)[1]; + const pathname = new URL(release.url).pathname; + release.entryId = pathname.match(/\/view\/(\d+)/)?.[1] || pathname.match(/\/view\/([\w-]+)/)?.[1]; release.description = query.cnt('.desc, .content-description'); release.date = query.date('.date, time, .hide', 'Do MMM YYYY'); @@ -29,14 +30,15 @@ async function scrapeAll(scenes) { }); } -function scrapeScene({ query }, url) { +async function scrapeScene({ query }, url) { const release = { director: 'Mike Adriano' }; if (query.exists('a[href*="stackpath.com"]')) { throw new Error('URL blocked by StackPath'); } - release.entryId = new URL(url).pathname.match(/\/view\/(\d+)/)[1]; + const pathname = new URL(url).pathname; + release.entryId = pathname.match(/\/view\/(\d+)/)?.[1] || pathname.match(/\/view\/([\w-]+)/)?.[1]; release.title = query.cnt('.content-page-info .title'); release.description = query.cnt('.content-page-info .desc'); @@ -45,16 +47,8 @@ function scrapeScene({ query }, url) { release.actors = query.cnts('.content-page-info .models a'); release.duration = query.dur('.content-page-info .total-time:last-child'); - release.poster = query.poster('.content-page-header video, .content-page-header-inner video'); - - const trailerEl = query.q('.content-page-header source, .content-page-header-inner source'); - - if (trailerEl) { - release.trailer = { - src: trailerEl.src, - type: trailerEl.type, - }; - } + release.poster = query.poster('.content-page-header video, .content-page-header-inner video') || query.poster('#main-player', 'data-screenshot'); + release.trailer = query.video('.content-page-header source, .content-page-header-inner source') || query.q('#main-player', 'data-url'); return release; }