Storing scene qualities. Updated Perv City scraper.

This commit is contained in:
DebaucheryLibrarian 2022-03-31 14:11:13 +02:00
parent 33a327a04b
commit 18b219850e
6 changed files with 58 additions and 5 deletions

View File

@ -203,6 +203,19 @@
</div> </div>
</div> </div>
<div
v-if="release.qualities"
class="row"
>
<span class="row-label">Available qualities</span>
<span
v-for="quality in release.qualities"
:key="quality"
class="quality"
>{{ quality }}</span>
</div>
<div <div
v-if="release.comment" v-if="release.comment"
class="row" class="row"
@ -470,6 +483,16 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.quality {
&::after {
content: 'p, ';
}
&:last-child::after {
content: 'p',
}
}
.releases { .releases {
margin: 0 0 .5rem 0; margin: 0 0 .5rem 0;
} }

View File

@ -367,6 +367,7 @@ const releaseFields = `
date date
datePrecision datePrecision
slug slug
qualities
shootId shootId
productionDate productionDate
comment comment
@ -475,6 +476,7 @@ const releaseFragment = `
duration duration
createdAt createdAt
shootId shootId
qualities
productionDate productionDate
createdBatchId createdBatchId
productionLocation productionLocation

View File

@ -0,0 +1,7 @@
exports.up = async (knex) => knex.schema.alterTable('releases', (table) => {
table.specificType('qualities', 'text[]');
});
exports.down = async (knex) => knex.schema.alterTable('releases', (table) => {
table.dropColumn('qualities');
});

View File

@ -0,0 +1,12 @@
exports.up = async (knex) => knex.raw(`
CREATE MATERIALIZED VIEW entities_stats
AS
SELECT entities.id AS entity_id, count(releases.id) AS releases_count
FROM entities
LEFT JOIN releases ON releases.entity_id = entities.id
GROUP BY entities.id;
`);
exports.down = async (knex) => knex.raw(`
DROP MATERIALIZED VIEW entities_stats;
`);

View File

@ -12,6 +12,13 @@ const channelCodes = {
uha: 'upherasshole', uha: 'upherasshole',
}; };
const qualities = {
v4k: 2160,
vFullHD: 1080,
vHD: 720,
vSD: 480,
};
const channelRegExp = new RegExp(Object.keys(channelCodes).join('|'), 'i'); const channelRegExp = new RegExp(Object.keys(channelCodes).join('|'), 'i');
function scrapeAll(scenes, entity) { function scrapeAll(scenes, entity) {
@ -42,9 +49,12 @@ function scrapeScene({ query }) {
release.entryId = query.q('.trailerLeft img', 'id').match(/set-target-(\d+)/)[1]; release.entryId = query.q('.trailerLeft img', 'id').match(/set-target-(\d+)/)[1];
release.title = query.cnt('.infoHeader h1'); release.title = query.cnt('.infoHeader h1');
release.description = query.cnt('.infoBox p'); release.description = query.cnt('.description');
release.duration = query.duration('.tRuntime');
release.actors = query.cnts('.infoBox .tour_update_models a'); release.actors = query.cnts('.infoBox .tour_update_models a');
release.tags = query.cnts('.tagcats a');
release.qualities = query.imgs('.avaiFormate img').map((src) => qualities[src.match(/\/(\w+)\.png/)[1]]).filter(Boolean);
release.poster = query.img('.posterimg'); release.poster = query.img('.posterimg');
release.photos = query.imgs('.trailerSnaps img').slice(1); // first photo is poster in lower quality release.photos = query.imgs('.trailerSnaps img').slice(1); // first photo is poster in lower quality

View File

@ -38,11 +38,8 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce
date_precision: release.datePrecision, date_precision: release.datePrecision,
slug, slug,
description: release.description, description: release.description,
qualities: release.qualities.map(Number).filter(Boolean),
comment: release.comment, comment: release.comment,
// director: release.director,
// likes: release.rating && release.rating.likes,
// dislikes: release.rating && release.rating.dislikes,
// rating: release.rating && release.rating.stars && Math.floor(release.rating.stars),
deep: typeof release.deep === 'boolean' ? release.deep : false, deep: typeof release.deep === 'boolean' ? release.deep : false,
deep_url: release.deepUrl, deep_url: release.deepUrl,
updated_batch_id: batchId, updated_batch_id: batchId,
@ -72,6 +69,8 @@ async function curateReleaseEntry(release, batchId, existingRelease, type = 'sce
curatedRelease.created_batch_id = batchId; curatedRelease.created_batch_id = batchId;
} }
console.log(curatedRelease);
return curatedRelease; return curatedRelease;
} }