Added rudimentary tags page. Improved social match behavior.

This commit is contained in:
2019-12-01 05:32:47 +01:00
parent bead69de49
commit cf81aa99e0
41 changed files with 495 additions and 104 deletions

View File

@@ -17,7 +17,8 @@ async function curateActor(actor) {
.where({ domain: 'actors', target_id: actor.id })
.orderBy('index'),
knex('social')
.where({ domain: 'actors', target_id: actor.id }),
.where({ domain: 'actors', target_id: actor.id })
.orderBy('platform', 'desc'),
]);
const curatedActor = {
@@ -128,11 +129,17 @@ function curateActorEntry(actor, scraped, scrapeSuccess) {
function curateSocialEntry(url, actorId) {
const platforms = [
// links supplied by PH often look like domain.com/domain.com/username
{
label: 'twitter',
pattern: 'http(s)\\://(*)twitter.com/:username(/)(?*)',
format: username => `https://www.twitter.com/${username}`,
},
{
label: 'youtube',
pattern: 'http(s)\\://(*)youtube.com/channel/:username(?*)',
format: username => `https://www.youtube.com/channel/${username}`,
},
{
label: 'instagram',
pattern: 'http(s)\\://(*)instagram.com/:username(/)(?*)',
@@ -148,11 +155,21 @@ function curateSocialEntry(url, actorId) {
pattern: 'http(s)\\://:username.tumblr.com(*)',
format: username => `https://${username}.tumblr.com`,
},
{
label: 'onlyfans',
pattern: 'http(s)\\://(*)onlyfans.com/:username(/)(?*)',
format: username => `https://www.onlyfans.com/${username}`,
},
{
label: 'fancentro',
pattern: 'http(s)\\://(www.)fancentro.com/:username(/)(?*)',
pattern: 'http(s)\\://(*)fancentro.com/:username(/)(?*)',
format: username => `https://www.fancentro.com/${username}`,
},
{
label: 'modelhub',
pattern: 'http(s)\\://(*)modelhub.com/:username(/)(?*)',
format: username => `https://www.modelhub.com/${username}`,
},
];
const match = platforms.reduce((acc, platform) => {
@@ -202,7 +219,7 @@ async function curateSocialEntries(urls, actorId) {
}, []);
}
async function fetchActors(queryObject) {
async function fetchActors(queryObject, limit = 100) {
const releases = await knex('actors')
.select(
'actors.*',
@@ -213,7 +230,7 @@ async function fetchActors(queryObject) {
.leftJoin('countries as residence_countries', 'actors.residence_country_alpha2', 'residence_countries.alpha2')
.orderBy(['actors.name', 'actors.gender'])
.where(builder => whereOr(queryObject, 'actors', builder))
.limit(100);
.limit(limit);
return curateActors(releases);
}