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", "name": "traxxx",
"version": "1.99.5", "version": "1.99.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

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

View File

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