Compare commits

...

2 Commits

Author SHA1 Message Date
ThePendulum 70afe75eb4 1.99.6 2020-02-23 22:37:17 +01:00
ThePendulum 164681427a Fixed Kelly Madison posters, marking frontpage video as teaser. 2020-02-23 22:37:14 +01:00
3 changed files with 13 additions and 11 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.99.5",
"version": "1.99.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.99.5",
"version": "1.99.6",
"description": "All the latest porn releases in one place",
"main": "src/app.js",
"scripts": {

View File

@ -50,8 +50,8 @@ function scrapeLatest(html, site) {
const durationString = durationEl.textContent.match(/\d+ min/);
if (durationString) release.duration = Number(durationString[0].match(/\d+/)[0]) * 60;
release.poster = scene.querySelector('.card-img-top').src;
release.trailer = {
release.poster = scene.querySelector('.card-img-top').dataset.src;
release.teaser = {
src: scene.querySelector('video').src,
};
@ -59,14 +59,14 @@ function scrapeLatest(html, site) {
}).filter(scene => scene);
}
function scrapeScene(html, url, site, shallowRelease) {
function scrapeScene(html, url, site, baseRelease) {
const { document } = new JSDOM(html).window;
const release = { url, site };
const titleEl = document.querySelector('.card-header.row h4').childNodes;
const titleString = extractTextNode(titleEl);
if (!shallowRelease) [release.entryId] = url.match(/\d+/);
if (!baseRelease) [release.entryId] = url.match(/\d+/);
release.title = titleString
.replace('Trailer: ', '')
@ -107,9 +107,11 @@ function scrapeScene(html, url, site, shallowRelease) {
quality: resolutions[index],
}));
release.photos = [document.body.innerHTML
.match(/poster: .*\.jpg/)[0]
.match(/https:\/\/.*\.jpg/)[0]];
const posterPrefix = html.indexOf('poster:');
const poster = html.slice(html.indexOf('http', posterPrefix), html.indexOf('.jpg', posterPrefix) + 4);
if (baseRelease?.poster) release.photos = [poster];
else release.poster = poster;
return release;
}
@ -154,7 +156,7 @@ async function fetchLatest(site, page = 1) {
return null;
}
async function fetchScene(url, site, shallowRelease) {
async function fetchScene(url, site, baseRelease) {
const { pathname } = new URL(url);
const res = await bhttp.get(`https://www.kellymadison.com${pathname}`, {
@ -163,7 +165,7 @@ async function fetchScene(url, site, shallowRelease) {
},
});
return scrapeScene(res.body.toString(), url, site, shallowRelease);
return scrapeScene(res.body.toString(), url, site, baseRelease);
}
async function fetchProfile(actorName) {