Improved case resolution in tag matching. Fixed Kelly Madison scraper returning BTS tag when indicating 'BTS available'.
This commit is contained in:
parent
2052af7977
commit
89c0cd8b2a
|
|
@ -202,6 +202,10 @@ const tags = [
|
|||
name: 'behind the scenes',
|
||||
slug: 'bts',
|
||||
},
|
||||
{
|
||||
name: 'BTS available',
|
||||
slug: 'hasbts',
|
||||
},
|
||||
{
|
||||
name: 'belgian',
|
||||
slug: 'belgian',
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ function scrapeSceneApi(data, channel, parameters) {
|
|||
}));
|
||||
}
|
||||
|
||||
release.tags = data.categories.map((category) => category.name);
|
||||
// BTS category is used to indicate the scene has a BTS video available, not that it itself is a BTS
|
||||
release.tags = data.categories.map((category) => (category.name.toLowerCase() === 'bts' ? 'bts available' : category.name));
|
||||
release.photoCount = data.photosetPhotoCount || data.episode_photoset_photo_count;
|
||||
|
||||
return release;
|
||||
|
|
|
|||
11
src/tags.js
11
src/tags.js
|
|
@ -74,19 +74,14 @@ function withRelations(queryBuilder, withMedia) {
|
|||
}
|
||||
|
||||
async function matchReleaseTags(releases) {
|
||||
const rawTags = releases
|
||||
const tags = releases
|
||||
.map((release) => release.tags).flat()
|
||||
.map((tag) => tag.trim().toLowerCase())
|
||||
.filter(Boolean);
|
||||
|
||||
const casedTags = [...new Set(
|
||||
rawTags
|
||||
.concat(rawTags.map((tag) => tag.trim().toLowerCase()))
|
||||
.concat(rawTags.map((tag) => tag.trim().toUpperCase())),
|
||||
)];
|
||||
|
||||
const tagEntries = await knex('tags')
|
||||
.select('tags.id', 'tags.name', 'tags.alias_for', 'tags.implied_tag_ids')
|
||||
.whereIn('tags.name', casedTags);
|
||||
.whereIn(knex.raw('lower(tags.name)'), tags);
|
||||
|
||||
const tagIdsBySlug = tagEntries
|
||||
.reduce((acc, tag) => ({
|
||||
|
|
|
|||
Loading…
Reference in New Issue