2019-03-24 04:28:18 +00:00
|
|
|
'use strict';
|
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
const { get, getAll } = require('../utils/qu');
|
|
|
|
|
|
|
|
function scrapeLatest(scenes) {
|
|
|
|
return scenes.map(({ qu }) => {
|
|
|
|
const release = {};
|
|
|
|
|
|
|
|
const href = qu.url('.shoot-thumb-title a');
|
|
|
|
release.url = `https://kink.com${href}`;
|
|
|
|
|
|
|
|
release.shootId = href.split('/').slice(-1)[0];
|
|
|
|
release.entryId = release.shootId;
|
|
|
|
|
|
|
|
release.title = qu.q('.shoot-thumb-title a', true);
|
|
|
|
release.date = qu.date('.date', 'MMM DD, YYYY');
|
|
|
|
|
|
|
|
release.actors = qu.all('.shoot-thumb-models a', true);
|
|
|
|
release.stars = qu.q('.average-rating', 'data-rating') / 10;
|
|
|
|
|
|
|
|
release.poster = qu.img('.adimage');
|
|
|
|
release.photos = qu.imgs('.rollover .roll-image', 'data-imagesrc').map(photo => [
|
|
|
|
photo.replace('410/', '830/'),
|
|
|
|
photo,
|
|
|
|
]);
|
|
|
|
|
|
|
|
release.duration = qu.dur('.video span');
|
|
|
|
|
|
|
|
return release;
|
2020-05-14 02:26:05 +00:00
|
|
|
});
|
2019-03-24 04:28:18 +00:00
|
|
|
}
|
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
async function scrapeScene({ qu }, url) {
|
|
|
|
const release = { url };
|
|
|
|
|
|
|
|
release.shootId = new URL(url).pathname.split('/')[2];
|
|
|
|
release.entryId = release.shootId;
|
|
|
|
|
|
|
|
release.title = qu.q('.shoot-title span.favorite-button', 'data-title');
|
|
|
|
release.description = qu.q('.description-text', true);
|
|
|
|
|
|
|
|
release.date = qu.date('.shoot-date', 'MMMM DD, YYYY');
|
|
|
|
release.actors = qu.all('.names a', true).map(actor => actor.replace(/,\s*/, ''));
|
|
|
|
release.director = qu.q('.director-name', true);
|
|
|
|
|
|
|
|
release.photos = qu.imgs('.gallery .thumb img', 'data-image-file');
|
|
|
|
release.poster = qu.poster();
|
|
|
|
|
|
|
|
release.tags = qu.all('.tag-list a[href*="/tag"]', true).map(tag => tag.replace(/,\s*/, ''));
|
|
|
|
|
|
|
|
const trailer = qu.q('.player span[data-type="trailer-src"]', 'data-url');
|
|
|
|
|
|
|
|
release.trailer = [
|
|
|
|
{
|
|
|
|
src: trailer.replace('480p', '1080p'),
|
|
|
|
quality: 1080,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: trailer.replace('480p', '720p'),
|
|
|
|
quality: 720,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: trailer,
|
2020-05-14 02:26:05 +00:00
|
|
|
quality: 480,
|
|
|
|
},
|
2020-06-27 00:57:30 +00:00
|
|
|
{
|
|
|
|
src: trailer.replace('480p', '360p'),
|
|
|
|
quality: 360,
|
2020-05-14 02:26:05 +00:00
|
|
|
},
|
2020-06-27 00:57:30 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
release.channel = qu.url('.shoot-logo a').split('/').slice(-1)[0];
|
|
|
|
|
|
|
|
return release;
|
2019-03-24 04:28:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 01:45:40 +00:00
|
|
|
async function fetchLatest(site, page = 1) {
|
2020-06-27 00:57:30 +00:00
|
|
|
const res = await getAll(`${site.url}/latest/page/${page}`, '.shoot-list .shoot');
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
return scrapeLatest(res.items, site);
|
|
|
|
}
|
2019-03-24 04:28:18 +00:00
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
return res.status;
|
2019-03-24 04:28:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchScene(url, site) {
|
2020-06-27 00:57:30 +00:00
|
|
|
const res = await get(url);
|
2019-03-24 04:28:18 +00:00
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
if (res.ok) {
|
|
|
|
return scrapeScene(res.item, url, site);
|
|
|
|
}
|
2019-03-24 04:28:18 +00:00
|
|
|
|
2020-06-27 00:57:30 +00:00
|
|
|
return res.status;
|
2019-03-24 04:28:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2020-05-14 02:26:05 +00:00
|
|
|
fetchLatest,
|
|
|
|
fetchScene,
|
2019-03-24 04:28:18 +00:00
|
|
|
};
|