Added native site support to Perv City scraper for DP Diva.
This commit is contained in:
@@ -43,7 +43,7 @@ function scrapeAll(scenes, entity) {
|
||||
});
|
||||
}
|
||||
|
||||
function scrapeScene({ query }) {
|
||||
function scrapeScene({ query }, channel) {
|
||||
const release = {};
|
||||
|
||||
release.entryId = query.q('.trailerLeft img', 'id').match(/set-target-(\d+)/)[1];
|
||||
@@ -62,7 +62,7 @@ function scrapeScene({ query }) {
|
||||
const trailer = query.q('script')?.textContent.match(/\/trailers\/.+\.mp4/)?.[0];
|
||||
|
||||
if (trailer) {
|
||||
release.trailer = `https://pervcity.com${trailer}`;
|
||||
release.trailer = `${channel.url}${trailer}`;
|
||||
release.channel = channelCodes[release.trailer.match(channelRegExp)?.[0]];
|
||||
}
|
||||
|
||||
@@ -95,15 +95,28 @@ function scrapeProfile({ query }) {
|
||||
return profile;
|
||||
}
|
||||
|
||||
async function fetchLatest(channel, page = 1) {
|
||||
function getLatestUrl(channel, page) {
|
||||
if (channel.parameters?.siteId) {
|
||||
const url = `https://pervcity.com/search.php?site[]=${channel.parameters.siteId}&page=${page}`;
|
||||
return `https://pervcity.com/search.php?site[]=${channel.parameters.siteId}&page=${page}`;
|
||||
}
|
||||
|
||||
if (channel.parameters?.native) {
|
||||
return `${channel.url}/search.php?site[]=&page=${page}`;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchLatest(channel, page = 1) {
|
||||
const url = getLatestUrl(channel, page);
|
||||
|
||||
if (url) {
|
||||
const res = await qu.getAll(url, '.videoBlock');
|
||||
|
||||
return res.ok ? scrapeAll(res.items, channel) : res.status;
|
||||
}
|
||||
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
|
||||
async function fetchUpcoming(channel) {
|
||||
|
||||
Reference in New Issue
Block a user