Compare commits

...

2 Commits

Author SHA1 Message Date
DebaucheryLibrarian 21a3bc44e6 1.214.2 2022-04-04 23:56:28 +02:00
DebaucheryLibrarian b00b8f4a96 Using channel URL for Dogfart photos and network URL as fallback. 2022-04-04 23:56:26 +02:00
3 changed files with 20 additions and 9 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "traxxx",
"version": "1.214.1",
"version": "1.214.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "traxxx",
"version": "1.214.1",
"version": "1.214.2",
"license": "ISC",
"dependencies": {
"@casl/ability": "^5.2.2",

View File

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

View File

@ -3,7 +3,7 @@
const slugify = require('../utils/slugify');
const qu = require('../utils/qu');
async function getPhotos(albumUrl) {
async function getPhotos(albumUrl, channel) {
const res = await qu.get(albumUrl);
if (!res.ok) {
@ -14,12 +14,21 @@ async function getPhotos(albumUrl) {
const lastPhotoIndex = parseInt(lastPhotoPage.match(/\d+.jpg/)[0], 10);
const photoUrls = Array.from({ length: lastPhotoIndex }, (value, index) => {
const pageUrl = `https://blacksonblondes.com${lastPhotoPage.replace(/\d+.jpg/, `${(index + 1).toString().padStart(3, '0')}.jpg`)}`;
const pageUrl = `${channel.url}${lastPhotoPage.replace(/\d+.jpg/, `${(index + 1).toString().padStart(3, '0')}.jpg`)}`;
const networkPageUrl = `https://dogfartnetwork.com${lastPhotoPage.replace('tourx', 'tour').replace(/\d+.jpg/, `${(index + 1).toString().padStart(3, '0')}.jpg`)}`;
return {
url: pageUrl,
extract: ({ query }) => query.img('.scenes-module img'),
};
const extract = ({ query }) => query.img('.scenes-module img');
return [
{
url: pageUrl,
extract,
},
{
url: networkPageUrl,
extract,
},
];
});
return photoUrls;
@ -90,6 +99,8 @@ async function scrapeScene({ query }, url, channel, baseScene, parameters) {
release.stars = Number(((query.number('span[itemprop="average"], span[itemprop="ratingValue"]') || query.number('canvas[data-score]', null, 'data-score')) / 2).toFixed(2));
console.log(release.photos);
return release;
}