From 916deff48730b164beca01ffe9bcf9a3b6aa9f5e Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 3 Jul 2023 00:50:47 +0200 Subject: [PATCH] Fixed Arch Angel placeholder thumbnail. --- public/img/banners/brazzers/brazzers_728_90.html | 1 + seeds/06_affiliates.js | 9 +++++++++ src/scrapers/archangel.js | 13 ++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 public/img/banners/brazzers/brazzers_728_90.html diff --git a/public/img/banners/brazzers/brazzers_728_90.html b/public/img/banners/brazzers/brazzers_728_90.html new file mode 100644 index 000000000..a975e2087 --- /dev/null +++ b/public/img/banners/brazzers/brazzers_728_90.html @@ -0,0 +1 @@ + diff --git a/seeds/06_affiliates.js b/seeds/06_affiliates.js index 3aeb0f7bf..a416bfbcd 100755 --- a/seeds/06_affiliates.js +++ b/seeds/06_affiliates.js @@ -261,6 +261,12 @@ const campaigns = [ affiliate: 'bang_signup', comment: 'per signup', }, + // brazzers + { + network: 'brazzers', + banner: 'brazzers_728_90', + comment: 'per signup', + }, // dfxtra / dogfart { network: 'dfxtra', @@ -693,6 +699,8 @@ exports.seed = async (knex) => Promise.resolve() })); } + console.log(file); + return { id: path.parse(file).name, network, @@ -769,6 +777,7 @@ exports.seed = async (knex) => Promise.resolve() url: campaign.url, affiliate_id: campaign.affiliate, banner_id: campaign.banner, + html: campaign.html, })).filter((link) => link.entity_id && (link.url || link.affiliate_id)); await knex('affiliates').insert(affiliatesWithEntityId); diff --git a/src/scrapers/archangel.js b/src/scrapers/archangel.js index 622232c88..64dc225f5 100755 --- a/src/scrapers/archangel.js +++ b/src/scrapers/archangel.js @@ -5,6 +5,8 @@ const unprint = require('unprint'); const slugify = require('../utils/slugify'); const { feetInchesToCm } = require('../utils/convert'); +const placeholder = /images\/p\d+\.jpe?g/i; + function getEntryId(release) { return slugify(new URL(release.url).pathname.match(/\/([\w-]+)\.html/)?.[1] || [unprint.formatDate(release.date, 'YYYY-MM-DD'), release.title, ...release.actors]); @@ -28,7 +30,7 @@ function scrapeAll(scenes) { const poster = query.img('img.mainThumb'); - if (poster && !/images\/p\d+\.jpe?g/i.test(poster)) { + if (poster && !placeholder.test(poster)) { release.poster = poster; } @@ -54,7 +56,12 @@ function scrapeScene({ query, html }, { url }) { url: unprint.query.url(actorEl, null), })); - release.poster = query.img('.update_thumb') || html.match(/poster="(.*\.jpg)"/)?.[1]; + const poster = query.img('.update_thumb') || html.match(/poster="(.*\.jpg)"/)?.[1]; + + if (poster && !placeholder.test(poster)) { + release.poster = poster; + } + release.trailer = html.match(/src="(.*\.mp4)"/)?.[1]; release.photoCount = query.number('.info', { match: /(\d+) photos/i, matchIndex: 1 }); @@ -115,7 +122,7 @@ function scrapeProfile({ query, element }, { url, entity }) { query.img('.model_bio_thumb', { attribute: 'src0_2x', origin: entity.url }), query.img('.model_bio_thumb', { attribute: 'src0_1x', origin: entity.url }), query.img('.model_bio_thumb', { attribute: 'src0', origin: entity.url }), - ].filter(Boolean); + ].filter((avatar) => avatar && !placeholder.test(avatar)); profile.scenes = scrapeAll(unprint.initAll(element, '.item-video'));