From 73676b86288e71583e792b724f3d96e3e85f0759 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 27 Aug 2024 02:16:25 +0200 Subject: [PATCH] Appending date to Jules Jordan title-derived entry ID. --- src/scrapers/julesjordan.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/scrapers/julesjordan.js b/src/scrapers/julesjordan.js index dd0d4f67..654251c9 100755 --- a/src/scrapers/julesjordan.js +++ b/src/scrapers/julesjordan.js @@ -25,6 +25,10 @@ function getEntryId(html) { return null; } +function getEntryIdFromTitle(release) { + return slugify([release.title, release.date && unprint.formatDate(release.date, 'YYYY-MM-DD')]); +} + function scrapeAll(scenes, site, entryIdFromTitle) { return scenes.map(({ element, query }) => { const release = {}; @@ -34,7 +38,10 @@ function scrapeAll(scenes, site, entryIdFromTitle) { release.url = query.url('.content_img a, .dvd_info > a, a.update_title, a[title]'); release.date = query.date('.update_date', ['MM/DD/YYYY', 'YYYY-MM-DD']); - release.entryId = (entryIdFromTitle && slugify(release.title)) || element.dataset.setid || query.element('.rating_box')?.dataset.id || query.attribute('a img', 'id')?.match(/set-target-(\d+)/)?.[1]; + release.entryId = (entryIdFromTitle && getEntryIdFromTitle(release)) + || element.dataset.setid + || query.element('.rating_box')?.dataset.id + || query.attribute('a img', 'id')?.match(/set-target-(\d+)/)?.[1]; release.actors = query.all('.content_img .update_models a, .update_models a').map((actorEl) => ({ name: unprint.query.content(actorEl), @@ -91,7 +98,9 @@ function scrapeUpcoming(scenes, channel) { release.poster = query.img('img') || query.img('img', { attribute: 'src0_1x' }); release.teaser = html.match(/src=['"](https:\/\/.*\.mp4)['"]/)?.[1]; - release.entryId = channel.parameters?.entryIdFromTitle ? slugify(release.title) : getEntryId(html); + release.entryId = channel.parameters?.entryIdFromTitle + ? getEntryIdFromTitle(release) + : getEntryId(html); return release; }); @@ -157,10 +166,13 @@ async function scrapeScene({ html, query }, context) { release.title = query.content('.title_bar_hilite, .movie_title'); release.description = query.content('.update_description') || query.text('//div[./span[contains(text(), "Description")]]'); - release.entryId = context.entity.parameters?.entryIdFromTitle ? slugify(release.title) : getEntryId(html); release.date = query.date(['.update_date', '//div[./span[contains(text(), "Date")]]'], ['MM/DD/YYYY', 'YYYY-MM-DD']); + release.entryId = context.entity.parameters?.entryIdFromTitle + ? getEntryIdFromTitle(release) + : getEntryId(html); + release.actors = query.all('.backgroundcolor_info > .update_models a, .item .update_models a, .player-scene-description .update_models a').map((actorEl) => ({ name: unprint.query.content(actorEl), url: unprint.query.url(actorEl, null),