Added URL helper to q. Getting social links from Boobpedia.
This commit is contained in:
parent
b30775faba
commit
6ef5c82c6a
|
@ -177,6 +177,11 @@ function curateSocialEntry(url, actorId) {
|
|||
pattern: 'http(s)\\://(*)modelhub.com/:username(/)(?*)',
|
||||
format: username => `https://www.modelhub.com/${username}`,
|
||||
},
|
||||
{
|
||||
label: 'imdb',
|
||||
pattern: 'http(s)\\://(*)imdb.com/name/:userId(/)(?*)',
|
||||
format: userId => `https://www.imdb.com/name/${userId}/`,
|
||||
},
|
||||
];
|
||||
|
||||
const match = platforms.reduce((acc, platform) => {
|
||||
|
|
|
@ -5,7 +5,7 @@ const bhttp = require('bhttp');
|
|||
const { ex } = require('../utils/q');
|
||||
|
||||
function scrapeProfile(html) {
|
||||
const { q, qa, qd, qi } = ex(html); /* eslint-disable-line object-curly-newline */
|
||||
const { q, qa, qd, qi, qu } = ex(html); /* eslint-disable-line object-curly-newline */
|
||||
const profile = {};
|
||||
|
||||
const bio = qa('.infobox tr[valign="top"]')
|
||||
|
@ -61,11 +61,9 @@ function scrapeProfile(html) {
|
|||
profile.avatar = `http://www.boobpedia.com${avatarPath}`;
|
||||
}
|
||||
|
||||
const socials = qa('.infobox a.external');
|
||||
profile.social = qu('.infobox a.external');
|
||||
|
||||
console.log(socials);
|
||||
|
||||
// return profile;
|
||||
return profile;
|
||||
}
|
||||
|
||||
async function fetchProfile(actorName) {
|
||||
|
|
|
@ -42,6 +42,10 @@ function qimages(context, selector = 'img', attr = 'src') {
|
|||
return qall(context, selector, attr);
|
||||
}
|
||||
|
||||
function qurls(context, selector = 'a', attr = 'href') {
|
||||
return qall(context, selector, attr);
|
||||
}
|
||||
|
||||
function qposter(context, selector = 'video', attr = 'poster') {
|
||||
return q(context, selector, attr);
|
||||
}
|
||||
|
@ -71,12 +75,14 @@ const funcs = {
|
|||
qposter,
|
||||
qlength,
|
||||
qtrailer,
|
||||
qurls,
|
||||
qa: qall,
|
||||
qd: qdate,
|
||||
qi: qimages,
|
||||
qp: qposter,
|
||||
ql: qlength,
|
||||
qt: qtrailer,
|
||||
qu: qurls,
|
||||
};
|
||||
|
||||
function ctx(element, window) {
|
||||
|
|
Loading…
Reference in New Issue