Using URL or title slug for Whale Member entry IDs for backwards compatability.
This commit is contained in:
@@ -3,17 +3,22 @@
|
||||
const unprint = require('unprint');
|
||||
|
||||
const { stripQuery } = require('../utils/url');
|
||||
const slugify = require('../utils/slugify');
|
||||
|
||||
function scrapeLatest(scenes, channel) {
|
||||
return scenes.map(({ query, element }) => {
|
||||
return scenes.map(({ query, _element }) => {
|
||||
const release = {};
|
||||
|
||||
release.url = query.url('[href*="/video"]');
|
||||
release.entryId = unprint.query.attribute(element, null, 'data-vid');
|
||||
// release.entryId = unprint.query.attribute(element, null, 'data-vid'); // does not match old videos
|
||||
|
||||
release.title = query.content('.video-thumbnail-footer a[href*="/video"]');
|
||||
release.date = query.date('.actor-list + span', 'MM/DD/YYYY');
|
||||
|
||||
release.entryId = release.url
|
||||
? new URL(release.url).pathname.split('/').at(-1)
|
||||
: slugify(release.title);
|
||||
|
||||
release.actors = query.all('.actor-list a').map((actorEl) => ({
|
||||
name: unprint.query.content(actorEl),
|
||||
url: unprint.query.url(actorEl, null, { origin: channel.url }),
|
||||
@@ -39,10 +44,11 @@ function scrapeLatest(scenes, channel) {
|
||||
});
|
||||
}
|
||||
|
||||
function scrapeScene({ query }, channel) {
|
||||
function scrapeScene({ query }, { url, entity }) {
|
||||
const release = {};
|
||||
|
||||
release.entryId = query.attribute('div[data-id]', 'data-id');
|
||||
// release.entryId = query.attribute('div[data-id]', 'data-id');
|
||||
release.entryId = new URL(url).pathname.split('/').at(-1);
|
||||
|
||||
release.title = query.content('.scene-info h1');
|
||||
release.description = query.content('//div[contains(@class, \'scene-info\')]//i[contains(@class, \'fa-quote\')]/following-sibling::span');
|
||||
@@ -51,7 +57,7 @@ function scrapeScene({ query }, channel) {
|
||||
|
||||
release.actors = query.all('.scene-info a[href*="/models"]').map((actorEl) => ({
|
||||
name: unprint.query.content(actorEl),
|
||||
url: unprint.query.url(actorEl, null, { origin: channel.url }),
|
||||
url: unprint.query.url(actorEl, null, { origin: entity.url }),
|
||||
}));
|
||||
|
||||
release.poster = query.poster('#player-wrapper video');
|
||||
|
||||
Reference in New Issue
Block a user