Added basic actor and network overview. Added DDF Network actor scraper. Various bug fixes and layout improvements.

This commit is contained in:
ThePendulum 2019-11-30 05:55:32 +01:00
parent 0dbe853f39
commit bead69de49
44 changed files with 1697 additions and 527 deletions

View File

@ -24,6 +24,7 @@
<li class="bio-header">
<h2 class="bio-name">{{ actor.name }}</h2>
<span
v-if="actor.gender"
class="bio-gender"
:class="{ male: actor.gender === 'male', female: actor.gender === 'female' }"
><Icon :icon="actor.gender" /></span>
@ -60,7 +61,7 @@
v-if="actor.origin.city"
class="city"
>{{ actor.origin.city }}</span><span
v-if="actor.origin.state && actor.origin.country && actor.origin.country.alpha2 === 'US'"
v-if="actor.origin.state && (!actor.origin.city || (actor.origin.country && actor.origin.country.alpha2 === 'US'))"
class="state"
>{{ actor.origin.city ? `, ${actor.origin.state}` : actor.origin.state }}</span>
@ -71,7 +72,7 @@
<img
class="flag"
:src="`/img/flags/${actor.origin.country.alpha2.toLowerCase()}.png`"
>{{ actor.origin.country.name }}
>{{ actor.origin.country.alias || actor.origin.country.name }}
</span>
</span>
</li>
@ -98,7 +99,7 @@
<img
class="flag"
:src="`/img/flags/${actor.residence.country.alpha2.toLowerCase()}.png`"
>{{ actor.residence.country.name }}
>{{ actor.residence.country.alias || actor.residence.country.name }}
</span>
</span>
</li>
@ -180,10 +181,10 @@
<span v-else>Yes</span>
</li>
<li class="bio-item scraped">Updated on {{ formatDate(actor.scrapedAt, 'YYYY-MM-DD HH:mm') }}</li>
<span class="scraped">Updated on {{ formatDate(actor.scrapedAt, 'YYYY-MM-DD HH:mm') }}</span>
</ul>
<div>
<div class="extra">
<p
v-if="actor.description"
class="description"
@ -223,38 +224,13 @@
v-if="actor.photos && actor.photos.length > 0"
class="photos-container"
>
<div
class="photos"
:class="{ wide: actor.photos.length > 2 }"
@wheel.prevent="scrollPhotos"
>
<a
v-if="actor.avatar"
:href="`/media/${actor.avatar.path}`"
target="_blank"
rel="noopener noreferrer"
class="avatar-link photo-link"
>
<img
:src="`/media/${actor.avatar.thumbnail}`"
class="avatar photo"
>
</a>
<Photos :actor="actor" />
<a
v-for="photo in actor.photos"
:key="`photo-${photo.id}`"
:href="`/media/${photo.path}`"
target="_blank"
rel="noopener noreferrer"
class="photo-link"
>
<img
:src="`/media/${photo.thumbnail}`"
class="photo"
>
</a>
</div>
<Photos
:actor="actor"
class="compact"
@wheel.native.prevent="scrollPhotos"
/>
</div>
<Releases :releases="releases" />
@ -268,6 +244,7 @@ import dayjs from 'dayjs';
import { cmToFeetInches, kgToLbs } from '../../../src/utils/convert';
import Photos from './photos.vue';
import FilterBar from '../header/filter-bar.vue';
import Releases from '../releases/releases.vue';
@ -296,7 +273,7 @@ function scrollDescription(event) {
}
async function mounted() {
[[this.actor]] = await Promise.all([
[this.actor] = await Promise.all([
this.$store.dispatch('fetchActors', this.$route.params.actorSlug),
this.fetchReleases(),
]);
@ -309,6 +286,7 @@ async function mounted() {
export default {
components: {
FilterBar,
Photos,
Releases,
},
data() {
@ -358,7 +336,7 @@ export default {
}
.avatar {
height: 12rem;
height: 15rem;
width: 12rem;
flex-shrink: 0;
margin: 0 1rem 0 0;
@ -385,24 +363,28 @@ export default {
.bio-item {
display: flex;
justify-content: space-between;
margin: 0 0 .5rem 0;
padding: 0 0 .25rem 0;
margin: 0 0 .25rem 0;
line-height: 1.75;
text-align: right;
font-size: .9rem;
font-weight: 600;
&:not(:last-of-type) {
border-bottom: solid 1px $highlight-hint;
}
}
.bio-label {
color: $highlight;
display: flex;
align-items: center;
margin: 0 1rem 0 0;
flex-shrink: 0;
font-style: normal;
font-weight: bold;
font-weight: 400;
.icon {
fill: $highlight;
margin: 0 .5rem .5rem 0;
margin: 0 .5rem 0 0;
}
}
@ -469,9 +451,18 @@ export default {
padding: 0 .5rem;
}
.description {
max-height: 10rem;
.scraped {
color: $highlight-weak;
margin: 1rem 0 0 0;
font-size: .8rem;
}
.extra {
flex-grow: 1;
}
.description {
max-height: 12rem;
position: relative;
display: block;
box-sizing: border-box;
@ -480,7 +471,6 @@ export default {
line-height: 1.5;
text-overflow: ellipsis;
font-size: .9rem;
cursor: pointer;
overflow: auto;
scrollbar-width: none;
@ -509,12 +499,6 @@ export default {
}
}
.scraped {
color: $highlight-weak;
margin: 1rem 0 0 0;
font-size: .8rem;
}
.actor-content {
display: flex;
flex-grow: 1;
@ -534,28 +518,9 @@ export default {
margin: 0 .5rem 0 0;
}
.photos {
display: inline-grid;
grid-template-columns: repeat(auto-fit, 15rem);
grid-gap: .5rem;
font-size: 0;
.avatar-link {
.photos.compact {
display: none;
}
}
.photo-link {
height: 15rem;
}
.photo {
width: 100%;
height: 100%;
object-fit: cover;
object-position: 50% 0;
box-shadow: 0 0 3px $shadow-weak;
}
.releases {
flex-grow: 1;
@ -568,15 +533,9 @@ export default {
}
}
@media(min-width: $breakpoint3) {
.photos.wide {
max-width: 35vw;
}
}
@media(max-width: $breakpoint3) {
.profile .avatar-link,
.social {
.extra {
display: none;
}
@ -592,25 +551,11 @@ export default {
}
.photos {
width: 100%;
max-width: 100%;
display: flex;
overflow-x: scroll;
scrollbar-width: none;
.avatar-link {
display: inline-block;
}
&::-webkit-scrollbar {
display: none;
}
}
.photo-link {
height: 15rem;
flex-shrink: 0;
margin: 0 .5rem 0 0;
.photos.compact {
display: flex;
}
}

View File

@ -0,0 +1,38 @@
<template>
<div class="actors">
<Actor
v-for="actor in actors"
:key="`actor-${actor.id}`"
:actor="actor"
/>
</div>
</template>
<script>
import Actor from '../tile/actor.vue';
async function mounted() {
this.actors = await this.$store.dispatch('fetchActors');
}
export default {
components: {
Actor,
},
data() {
return {
actors: [],
};
},
mounted,
};
</script>
<style lang="scss" scoped>
.actors {
display: grid;
grid-template-columns: repeat(auto-fit, 10rem);
grid-gap: 0 .5rem;
padding: 1rem;
}
</style>

View File

@ -0,0 +1,100 @@
<template>
<div
class="photos"
:class="{ wide: actor.photos.length > 2 }"
>
<a
v-if="actor.avatar"
:href="`/media/${actor.avatar.path}`"
target="_blank"
rel="noopener noreferrer"
class="avatar-link photo-link"
>
<img
:src="`/media/${actor.avatar.thumbnail}`"
class="avatar photo"
>
</a>
<a
v-for="photo in actor.photos"
:key="`photo-${photo.id}`"
:href="`/media/${photo.path}`"
target="_blank"
rel="noopener noreferrer"
class="photo-link"
>
<img
:src="`/media/${photo.thumbnail}`"
class="photo"
>
</a>
</div>
</template>
<script>
export default {
props: {
actor: {
type: Object,
default: null,
},
},
};
</script>
<style lang="scss" scoped>
@import 'theme';
.photos {
display: inline-grid;
grid-template-columns: repeat(auto-fit, 12rem);
grid-gap: .5rem;
font-size: 0;
.avatar-link {
display: none;
}
}
.photo-link {
height: 15rem;
}
.photo {
width: 100%;
height: 100%;
object-fit: cover;
box-shadow: 0 0 3px $shadow-weak;
}
@media(min-width: $breakpoint3) {
.photos.wide {
max-width: 30vw;
}
}
@media(max-width: $breakpoint3) {
.photos {
width: 100%;
max-width: 100%;
display: flex;
overflow-x: scroll;
scrollbar-width: none;
.avatar-link {
display: inline-block;
}
&::-webkit-scrollbar {
display: none;
}
}
.photo-link {
height: 15rem;
flex-shrink: 0;
margin: 0 .5rem 0 0;
}
}
</style>

View File

@ -1,11 +1,40 @@
<template>
<header class="header">
<router-link
:to="{ name: 'home' }"
<a
href="/"
class="logo-link"
>
<h1 class="logo">traxxx</h1>
</router-link>
><h1 class="logo">traxxx</h1></a>
<nav class="nav">
<ul class="nolist">
<li class="nav-item">
<Icon icon="stars" />
<a
href="/actors"
class="nav-link"
>Actors</a>
</li>
<li class="nav-item">
<Icon icon="earth2" />
<a
href="/networks"
class="nav-link"
>Networks</a>
</li>
<li class="nav-item">
<Icon icon="price-tags" />
<a
href="/tags"
class="nav-link"
>Categories</a>
</li>
</ul>
</nav>
</header>
</template>
@ -13,19 +42,41 @@
@import 'theme';
.header {
display: flex;
align-items: center;
background: $background;
color: $primary;
padding: .5rem 1rem;
border-bottom: solid 1px $shadow-hint;
font-size: 0;
}
.logo-link {
color: inherit;
display: inline-block;
text-decoration: none;
}
.logo {
display: inline-block;
margin: 0;
padding: .5rem 1rem;
margin: 0 1rem 0 0;
font-size: 2rem;
}
.nav {
display: inline-block;
}
.nav-link {
display: inline-block;
color: $shadow;
padding: 1rem;
text-decoration: none;
font-size: 1rem;
font-weight: bold;
&:hover {
color: $primary;
}
}
</style>

View File

@ -0,0 +1,40 @@
<template>
<div class="networks">
<Network
v-for="network in networks"
:key="`network-${network.id}`"
:network="network"
/>
</div>
</template>
<script>
import Network from '../tile/network.vue';
async function mounted() {
this.networks = await this.$store.dispatch('fetchNetworks');
console.log(this.networks);
}
export default {
components: {
Network,
},
data() {
return {
networks: [],
};
},
mounted,
};
</script>
<style lang="scss" scoped>
.networks {
display: grid;
grid-template-columns: repeat(auto-fit, 15rem);
grid-gap: 1rem;
padding: 1rem;
}
</style>

View File

@ -7,11 +7,14 @@
:href="`/actor/${actor.slug}`"
class="link"
>
<span class="name">{{ actor.name }}</span>
<span
v-tooltip.top="actor.name"
class="name"
>{{ actor.name }}</span>
<img
v-if="actor.avatar"
:src="`/media/${actor.avatar}`"
:src="`/media/${actor.avatar.thumbnail || actor.avatar}`"
class="avatar"
>
@ -38,6 +41,7 @@ export default {
@import 'theme';
.actor {
width: 10rem;
background: $background;
display: inline-block;
margin: 0 .5rem .5rem 0;
@ -57,6 +61,9 @@ export default {
.name {
display: block;
padding: .5rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: bold;
}
@ -64,10 +71,11 @@ export default {
color: $shadow-weak;
background: $shadow-hint;
height: 12rem;
width: 10rem;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
object-fit: cover;
object-position: 50% 0;
}
</style>

View File

@ -0,0 +1,66 @@
<template>
<a
:href="`/network/${network.slug}`"
:title="network.name"
class="tile"
>
<object
:data="`/img/logos/${network.slug}/network.png`"
type="image/png"
class="logo"
>{{ network.name }}</object>
</a>
</template>
<script>
export default {
props: {
network: {
type: Object,
default: null,
},
},
};
</script>
<style lang="scss" scoped>
@import 'theme';
.tile {
background: $background;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: .5rem 1rem;
border-radius: .25rem;
box-shadow: 0 0 3px rgba(0, 0, 0, .25);
height: 100%;
text-align: center;
}
.link {
text-decoration: none;
}
.logo {
width: 100%;
height: 5rem;
color: $text;
display: flex;
align-items: center;
justify-content: center;
object-fit: contain;
font-size: 1rem;
font-weight: bold;
filter: drop-shadow(0 0 1px $shadow);
}
.title {
color: $text;
height: 100%;
display: flex;
align-items: center;
margin: 0;
}
</style>

View File

@ -53,6 +53,7 @@ export default {
object-fit: contain;
font-size: 1rem;
font-weight: bold;
filter: drop-shadow(0 0 1px $shadow);
}
.title {

View File

@ -17,9 +17,10 @@ $shadow-weak: rgba(0, 0, 0, .2);
$shadow-hint: rgba(0, 0, 0, .1);
$highlight: rgba(255, 255, 255, .5);
$highlight-weak: rgba(255, 255, 255, .2);
$highlight-extreme: rgba(255, 255, 255, .9);
$highlight-strong: rgba(255, 255, 255, .7);
$highlight-weak: rgba(255, 255, 255, .2);
$highlight-hint: rgba(255, 255, 255, .075);
$profile: #222;

73
assets/img/fancentro.svg Normal file
View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="37.591999"
height="35.879002"
viewBox="0 0 37.591998 35.879002"
version="1.1"
id="svg13"
sodipodi:docname="fancentro.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata19">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs17" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1026"
id="namedview15"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="4.3779009"
inkscape:cx="57.7973"
inkscape:cy="19.477246"
inkscape:window-x="1047"
inkscape:window-y="930"
inkscape:window-maximized="1"
inkscape:current-layer="Group_7638" />
<g
id="Group_7639"
data-name="Group 7639"
transform="translate(-18.259,-0.342)">
<g
id="Group_7638"
data-name="Group 7638"
transform="translate(0,0.337)"
style="fill-opacity:1">
<path
id="Subtraction_220"
data-name="Subtraction 220"
d="m 8.54,35.879 v 0 l 1.837,-7.8 L 0,30.237 0.475,29.069 4.252,19.546 4.778,18.219 5.086,17.438 5.195,17.161 5.518,16.348 6.709,13.4 12.122,0 h 13.35 l 5.1,12.572 1.534,3.776 0.323,0.813 0.109,0.277 0.309,0.781 3.539,8.927 0.763,1.924 0.443,1.168 -10.344,-2.166 1.83,7.8 L 18.812,28.416 8.543,35.877 Z M 7.2,17.332 l 7.171,5.207 -2.292,7.053 -0.444,1.374 6.7,-4.873 0.46,-0.333 v 0 l 0.461,0.333 6.7,4.873 -0.447,-1.374 -2.289,-7.053 7.17,-5.207 H 21.534 L 18.8,8.905 16.064,17.331 Z"
transform="translate(18.259,0.005)"
style="opacity:1;fill-opacity:1;stroke:none;stroke-width:1;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -4,8 +4,10 @@ import VueRouter from 'vue-router';
import Home from '../components/home/home.vue';
import Release from '../components/release/release.vue';
import Site from '../components/site/site.vue';
import Network from '../components/network/network.vue';
import Actor from '../components/actor/actor.vue';
import Network from '../components/networks/network.vue';
import Networks from '../components/networks/networks.vue';
import Actor from '../components/actors/actor.vue';
import Actors from '../components/actors/actors.vue';
import Tag from '../components/tag/tag.vue';
import NotFound from '../components/errors/404.vue';
@ -47,6 +49,16 @@ const routes = [
component: Tag,
name: 'tag',
},
{
path: '/actors',
component: Actors,
name: 'actors',
},
{
path: '/networks',
component: Networks,
name: 'networks',
},
{
path: '*',
component: NotFound,

View File

@ -4,10 +4,18 @@ exports.up = knex => Promise.resolve()
.unique()
.primary();
table.string('alpha3', 3)
.unique();
table.string('name')
.notNullable();
table.string('alias');
table.integer('code', 3);
table.string('nationality');
table.integer('priority', 2)
.defaultTo(0);
}))
.then(() => knex.schema.createTable('actors', (table) => {
table.increments('id', 12);

View File

@ -254,6 +254,7 @@
/* $primary: #ff886c; */
.actor[data-v-6989dc6f] {
width: 10rem;
background: #fff;
display: inline-block;
margin: 0 .5rem .5rem 0;
@ -270,18 +271,23 @@
.name[data-v-6989dc6f] {
display: block;
padding: .5rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: bold;
}
.avatar[data-v-6989dc6f] {
color: rgba(0, 0, 0, 0.2);
background: rgba(0, 0, 0, 0.1);
height: 12rem;
width: 10rem;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
-o-object-fit: cover;
object-fit: cover;
-o-object-position: 50% 0;
object-position: 50% 0;
}
/* $primary: #ff886c; */
@ -535,6 +541,8 @@
object-fit: contain;
font-size: 1rem;
font-weight: bold;
-webkit-filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}
.title[data-v-f4958086] {
color: #222;
@ -545,51 +553,142 @@
}
/* $primary: #ff886c; */
.header[data-v-757c14c2] {
.header[data-v-e2e12602] {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: top;
margin: 0 0 2rem 0;
}
.title[data-v-757c14c2] {
.title[data-v-e2e12602] {
display: inline-flex;
align-items: top;
margin: 0 1rem 0 0;
}
.title:hover .icon[data-v-757c14c2] {
.title:hover .icon[data-v-e2e12602] {
fill: #ff6c88;
}
.logo[data-v-757c14c2] {
.logo[data-v-e2e12602] {
width: 20rem;
max-height: 8rem;
-o-object-fit: contain;
object-fit: contain;
margin: 0 .5rem 0 0;
}
.sites[data-v-757c14c2] {
.sites[data-v-e2e12602] {
display: grid;
grid-gap: 1rem;
margin: 0 0 2rem 0;
}
.sites[data-v-757c14c2] {
.sites[data-v-e2e12602] {
grid-template-columns: repeat(auto-fit, 15rem);
}
@media (max-width: 720px) {
.sites[data-v-757c14c2] {
.sites[data-v-e2e12602] {
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
}
/* $primary: #ff886c; */
.actor-inner[data-v-677a8360] {
.tile[data-v-8b4c90b0] {
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: .5rem 1rem;
border-radius: .25rem;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.25);
height: 100%;
text-align: center;
}
.link[data-v-8b4c90b0] {
text-decoration: none;
}
.logo[data-v-8b4c90b0] {
width: 100%;
height: 5rem;
color: #222;
display: flex;
align-items: center;
justify-content: center;
-o-object-fit: contain;
object-fit: contain;
font-size: 1rem;
font-weight: bold;
-webkit-filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}
.title[data-v-8b4c90b0] {
color: #222;
height: 100%;
display: flex;
align-items: center;
margin: 0;
}
.networks[data-v-4709d404] {
display: grid;
grid-template-columns: repeat(auto-fit, 15rem);
grid-gap: 1rem;
padding: 1rem;
}
/* $primary: #ff886c; */
.photos[data-v-0a0430c7] {
display: inline-grid;
grid-template-columns: repeat(auto-fit, 12rem);
grid-gap: .5rem;
font-size: 0;
}
.photos .avatar-link[data-v-0a0430c7] {
display: none;
}
.photo-link[data-v-0a0430c7] {
height: 15rem;
}
.photo[data-v-0a0430c7] {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}
@media (min-width: 1200px) {
.photos.wide[data-v-0a0430c7] {
max-width: 30vw;
}
}
@media (max-width: 1200px) {
.photos[data-v-0a0430c7] {
width: 100%;
max-width: 100%;
display: flex;
overflow-x: scroll;
scrollbar-width: none;
}
.photos .avatar-link[data-v-0a0430c7] {
display: inline-block;
}
.photos[data-v-0a0430c7]::-webkit-scrollbar {
display: none;
}
.photo-link[data-v-0a0430c7] {
height: 15rem;
flex-shrink: 0;
margin: 0 .5rem 0 0;
}
}
/* $primary: #ff886c; */
.actor-inner[data-v-ea0483c2] {
height: 100%;
display: flex;
flex-direction: column;
padding: 0;
overflow-x: auto;
}
.profile[data-v-677a8360] {
.profile[data-v-ea0483c2] {
background: #222;
color: rgba(255, 255, 255, 0.9);
width: 100%;
@ -597,12 +696,12 @@
flex-direction: row;
flex-shrink: 0;
}
.profile .avatar-link[data-v-677a8360] {
.profile .avatar-link[data-v-ea0483c2] {
font-size: 0;
padding: 1rem 0 1rem 1rem;
}
.profile .avatar[data-v-677a8360] {
height: 12rem;
.profile .avatar[data-v-ea0483c2] {
height: 15rem;
width: 12rem;
flex-shrink: 0;
margin: 0 1rem 0 0;
@ -611,94 +710,104 @@
-o-object-position: 50% 0;
object-position: 50% 0;
}
.bio[data-v-677a8360] {
.bio[data-v-ea0483c2] {
flex-grow: 1;
min-width: 20rem;
box-sizing: border-box;
padding: 1rem;
margin: 0 2rem 0 0;
}
.bio-header[data-v-677a8360] {
.bio-header[data-v-ea0483c2] {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 0 1rem 0;
}
.bio-item[data-v-677a8360] {
.bio-item[data-v-ea0483c2] {
display: flex;
justify-content: space-between;
margin: 0 0 .5rem 0;
padding: 0 0 .25rem 0;
margin: 0 0 .25rem 0;
line-height: 1.75;
text-align: right;
font-size: .9rem;
font-weight: 600;
}
.bio-label[data-v-677a8360] {
.bio-item[data-v-ea0483c2]:not(:last-of-type) {
border-bottom: solid 1px rgba(255, 255, 255, 0.075);
}
.bio-label[data-v-ea0483c2] {
color: rgba(255, 255, 255, 0.5);
display: flex;
align-items: center;
margin: 0 1rem 0 0;
flex-shrink: 0;
font-style: normal;
font-weight: bold;
font-weight: 400;
}
.bio-label .icon[data-v-677a8360] {
.bio-label .icon[data-v-ea0483c2] {
fill: rgba(255, 255, 255, 0.5);
margin: 0 .5rem .5rem 0;
margin: 0 .5rem 0 0;
}
.bio-value[data-v-677a8360] {
.bio-value[data-v-ea0483c2] {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.flag[data-v-677a8360] {
.flag[data-v-ea0483c2] {
margin: 0 .25rem 0 0;
}
.bio-name[data-v-677a8360] {
.bio-name[data-v-ea0483c2] {
display: inline-block;
padding: 0;
margin: 0;
}
.bio-gender[data-v-677a8360] {
.bio-gender[data-v-ea0483c2] {
display: inline-block;
font-weight: bold;
text-transform: capitalize;
font-weight: normal;
}
.bio-gender .icon[data-v-677a8360] {
.bio-gender .icon[data-v-ea0483c2] {
width: 1.25rem;
height: 1.25rem;
}
.bio-gender.female .icon[data-v-677a8360] {
.bio-gender.female .icon[data-v-ea0483c2] {
fill: #f0a;
}
.bio-gender.male .icon[data-v-677a8360] {
.bio-gender.male .icon[data-v-ea0483c2] {
fill: #0af;
}
.birthdate[data-v-677a8360] {
.birthdate[data-v-ea0483c2] {
display: block;
}
.age[data-v-677a8360] {
.age[data-v-ea0483c2] {
font-weight: bold;
padding: 0 0 0 .5rem;
border-left: solid 1px rgba(255, 255, 255, 0.2);
margin: 0 0 0 .5rem;
}
.country[data-v-677a8360] {
.country[data-v-ea0483c2] {
display: block;
}
.height-imperial[data-v-677a8360],
.weight-imperial[data-v-677a8360] {
.height-imperial[data-v-ea0483c2],
.weight-imperial[data-v-ea0483c2] {
padding: 0 0 0 .5rem;
border-left: solid 1px rgba(255, 255, 255, 0.2);
margin: 0 0 0 .5rem;
}
.enhanced.icon[data-v-677a8360] {
.enhanced.icon[data-v-ea0483c2] {
fill: #ff6c88;
padding: 0 .5rem;
}
.description[data-v-677a8360] {
max-height: 10rem;
.scraped[data-v-ea0483c2] {
color: rgba(255, 255, 255, 0.2);
margin: 1rem 0 0 0;
font-size: .8rem;
}
.extra[data-v-ea0483c2] {
flex-grow: 1;
}
.description[data-v-ea0483c2] {
max-height: 12rem;
position: relative;
display: block;
box-sizing: border-box;
@ -707,146 +816,112 @@
line-height: 1.5;
text-overflow: ellipsis;
font-size: .9rem;
cursor: pointer;
overflow: auto;
scrollbar-width: none;
}
.description[data-v-677a8360]::-webkit-scrollbar {
.description[data-v-ea0483c2]::-webkit-scrollbar {
display: none;
}
.social[data-v-677a8360] {
.social[data-v-ea0483c2] {
display: block;
margin: 1rem 0;
}
.social-link[data-v-677a8360] {
.social-link[data-v-ea0483c2] {
display: inline-block;
padding: 0 1rem 0 0;
}
.social-link .icon[data-v-677a8360] {
.social-link .icon[data-v-ea0483c2] {
fill: rgba(255, 255, 255, 0.5);
width: 1.5rem;
height: 1.5rem;
}
.social-link:hover .icon[data-v-677a8360] {
.social-link:hover .icon[data-v-ea0483c2] {
fill: #ff6c88;
}
.scraped[data-v-677a8360] {
color: rgba(255, 255, 255, 0.2);
margin: 1rem 0 0 0;
font-size: .8rem;
}
.actor-content[data-v-677a8360] {
.actor-content[data-v-ea0483c2] {
display: flex;
flex-grow: 1;
flex-direction: row;
}
.heading[data-v-677a8360] {
.heading[data-v-ea0483c2] {
padding: 0;
margin: 0 0 1rem 0;
}
.photos-container[data-v-677a8360] {
.photos-container[data-v-ea0483c2] {
min-width: 15rem;
box-sizing: border-box;
border-right: solid 1px rgba(0, 0, 0, 0.1);
padding: 1rem 1.5rem 1rem 1rem;
margin: 0 .5rem 0 0;
}
.photos[data-v-677a8360] {
display: inline-grid;
grid-template-columns: repeat(auto-fit, 15rem);
grid-gap: .5rem;
font-size: 0;
}
.photos .avatar-link[data-v-677a8360] {
.photos.compact[data-v-ea0483c2] {
display: none;
}
.photo-link[data-v-677a8360] {
height: 15rem;
}
.photo[data-v-677a8360] {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
-o-object-position: 50% 0;
object-position: 50% 0;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}
.releases[data-v-677a8360] {
.releases[data-v-ea0483c2] {
flex-grow: 1;
padding: 1rem;
}
@media (max-width: 1500px) {
.description[data-v-677a8360] {
.description[data-v-ea0483c2] {
display: none;
}
}
@media (min-width: 1200px) {
.photos.wide[data-v-677a8360] {
max-width: 35vw;
}
}
@media (max-width: 1200px) {
.profile .avatar-link[data-v-677a8360],
.social[data-v-677a8360] {
.profile .avatar-link[data-v-ea0483c2],
.extra[data-v-ea0483c2] {
display: none;
}
.actor-content[data-v-677a8360] {
.actor-content[data-v-ea0483c2] {
flex-direction: column;
}
.photos-container[data-v-677a8360] {
.photos-container[data-v-ea0483c2] {
border: none;
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
padding: 1rem 1rem 1.5rem 1rem;
margin: 0 0 .5rem 0;
}
.photos[data-v-677a8360] {
width: 100%;
max-width: 100%;
display: flex;
overflow-x: scroll;
scrollbar-width: none;
}
.photos .avatar-link[data-v-677a8360] {
display: inline-block;
}
.photos[data-v-677a8360]::-webkit-scrollbar {
.photos[data-v-ea0483c2] {
display: none;
}
.photo-link[data-v-677a8360] {
height: 15rem;
flex-shrink: 0;
margin: 0 .5rem 0 0;
.photos.compact[data-v-ea0483c2] {
display: flex;
}
}
@media (max-width: 720px) {
.profile[data-v-677a8360] {
.profile[data-v-ea0483c2] {
flex-direction: column;
padding: 0 0 .5rem 0;
}
.bio[data-v-677a8360] {
.bio[data-v-ea0483c2] {
width: 100%;
padding: 0 1rem;
margin: 0;
}
.bio-header[data-v-677a8360] {
.bio-header[data-v-ea0483c2] {
margin: 1rem 0;
}
.city[data-v-677a8360],
.state[data-v-677a8360],
.ethnicity[data-v-677a8360],
.residence[data-v-677a8360],
.weight[data-v-677a8360],
.tattoos[data-v-677a8360],
.piercings[data-v-677a8360],
.scraped[data-v-677a8360] {
.city[data-v-ea0483c2],
.state[data-v-ea0483c2],
.ethnicity[data-v-ea0483c2],
.residence[data-v-ea0483c2],
.weight[data-v-ea0483c2],
.tattoos[data-v-ea0483c2],
.piercings[data-v-ea0483c2],
.scraped[data-v-ea0483c2] {
display: none;
}
.social[data-v-677a8360] {
.social[data-v-ea0483c2] {
padding: 0 1rem;
}
}
.actors[data-v-4f34b238] {
display: grid;
grid-template-columns: repeat(auto-fit, 10rem);
grid-gap: 0 .5rem;
padding: 1rem;
}
/* $primary: #ff886c; */
.header[data-v-80991bcc] {
display: flex;
@ -1006,18 +1081,37 @@ body {
/* $primary: #ff886c; */
.header[data-v-10b7ec04] {
display: flex;
align-items: center;
background: #fff;
color: #ff6c88;
padding: .5rem 1rem;
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
font-size: 0;
}
.logo-link[data-v-10b7ec04] {
color: inherit;
display: inline-block;
text-decoration: none;
}
.logo[data-v-10b7ec04] {
display: inline-block;
margin: 0;
padding: .5rem 1rem;
margin: 0 1rem 0 0;
font-size: 2rem;
}
.nav[data-v-10b7ec04] {
display: inline-block;
}
.nav-link[data-v-10b7ec04] {
display: inline-block;
color: rgba(0, 0, 0, 0.5);
padding: 1rem;
text-decoration: none;
font-size: 1rem;
font-weight: bold;
}
.nav-link[data-v-10b7ec04]:hover {
color: #ff6c88;
}
/* $primary: #ff886c; */

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 143 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
'use strict';
const Promise = require('bluebird');
const UrlPattern = require('url-pattern');
const knex = require('./knex');
const argv = require('./argv');
@ -54,6 +55,7 @@ async function curateActor(actor) {
curatedActor.origin.country = {
alpha2: actor.birth_country_alpha2,
name: actor.birth_country_name,
alias: actor.birth_country_alias,
};
}
@ -64,6 +66,7 @@ async function curateActor(actor) {
curatedActor.residence.country = {
alpha2: actor.residence_country_alpha2,
name: actor.residence_country_name,
alias: actor.residence_country_alias,
};
}
@ -124,12 +127,54 @@ function curateActorEntry(actor, scraped, scrapeSuccess) {
}
function curateSocialEntry(url, actorId) {
const { hostname, origin, pathname } = new URL(url);
const platform = ['facebook', 'twitter', 'instagram', 'tumblr', 'snapchat', 'amazon', 'youtube', 'fancentro'].find(platformName => hostname.match(platformName));
const platforms = [
{
label: 'twitter',
pattern: 'http(s)\\://(*)twitter.com/:username(/)(?*)',
format: username => `https://www.twitter.com/${username}`,
},
{
label: 'instagram',
pattern: 'http(s)\\://(*)instagram.com/:username(/)(?*)',
format: username => `https://www.instagram.com/${username}`,
},
{
label: 'snapchat',
pattern: 'http(s)\\://(*)snapchat.com/add/:username(/)(?*)',
format: username => `https://www.snapchat.com/add/${username}`,
},
{
label: 'tumblr',
pattern: 'http(s)\\://:username.tumblr.com(*)',
format: username => `https://${username}.tumblr.com`,
},
{
label: 'fancentro',
pattern: 'http(s)\\://(www.)fancentro.com/:username(/)(?*)',
format: username => `https://www.fancentro.com/${username}`,
},
];
const match = platforms.reduce((acc, platform) => {
if (acc) return acc;
const patternMatch = new UrlPattern(platform.pattern).match(url);
if (patternMatch) {
return {
platform: platform.label,
original: url,
username: patternMatch.username,
url: platform.format ? platform.format(patternMatch.username) : url,
};
}
return null;
}, null) || { url };
return {
url: `${origin}${pathname}`,
platform,
url: match.url,
platform: match.platform,
domain: 'actors',
target_id: actorId,
};
@ -148,7 +193,7 @@ async function curateSocialEntries(urls, actorId) {
return urls.reduce((acc, url) => {
const socialEntry = curateSocialEntry(url, actorId);
if (acc.some(entry => socialEntry.url === entry.url) || existingSocialLinks.some(entry => socialEntry.url === entry.url)) {
if (acc.some(entry => socialEntry.url.toLowerCase() === entry.url.toLowerCase()) || existingSocialLinks.some(entry => socialEntry.url.toLowerCase() === entry.url.toLowerCase())) {
// prevent duplicates
return acc;
}
@ -161,11 +206,12 @@ async function fetchActors(queryObject) {
const releases = await knex('actors')
.select(
'actors.*',
'birth_countries.alpha2 as birth_country_alpha2', 'birth_countries.name as birth_country_name',
'residence_countries.alpha2 as residence_country_alpha2', 'residence_countries.name as residence_country_name',
'birth_countries.alpha2 as birth_country_alpha2', 'birth_countries.name as birth_country_name', 'birth_countries.alias as birth_country_alias',
'residence_countries.alpha2 as residence_country_alpha2', 'residence_countries.name as residence_country_name', 'residence_countries.alias as residence_country_alias',
)
.leftJoin('countries as birth_countries', 'actors.birth_country_alpha2', 'birth_countries.alpha2')
.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);
@ -215,7 +261,7 @@ async function mergeProfiles(profiles, actor) {
return {
id: actor ? actor.id : null,
name: actor ? actor.name : profile.name,
name: actor ? actor.name : (prevProfile.name || profile.name),
description: prevProfile.description || profile.description,
gender: prevProfile.gender || profile.gender,
birthdate: Number.isNaN(Number(prevProfile.birthdate)) ? profile.birthdate : prevProfile.birthdate,
@ -257,9 +303,10 @@ async function scrapeActors(actorNames) {
await Promise.map(actorNames || argv.actors, async (actorName) => {
try {
const actorSlug = actorName.toLowerCase().replace(/\s+/g, '-');
const actorEntry = await knex('actors').where({ slug: actorSlug }).first();
const profiles = await Promise.map(Object.entries(scrapers.actors), async ([scraperSlug, scraper]) => {
const sources = argv.sources ? argv.sources.map(source => [source, scrapers.actors[source]]) : Object.entries(scrapers.actors);
const profiles = await Promise.map(sources, async ([scraperSlug, scraper]) => {
const profile = await scraper.fetchProfile(actorEntry ? actorEntry.name : actorName);
return {

View File

@ -24,6 +24,11 @@ const { argv } = yargs
type: 'array',
alias: 'actor',
})
.option('sources', {
describe: 'Only use these scrapers for actor data',
type: 'array',
alias: 'source',
})
.option('deep', {
describe: 'Fetch details for all releases',
type: 'boolean',

View File

@ -117,6 +117,9 @@ async function scrapeReleases() {
try {
const siteReleases = await scrapeSiteReleases(scraper, site);
const siteActors = siteReleases.reduce((acc, release) => [...acc, ...release.actors], []);
console.log(siteActors);
if (argv.save) {
await storeReleases(siteReleases);

View File

@ -130,7 +130,7 @@ function scrapeActorSearch(html, url, actorName) {
const { document } = new JSDOM(html).window;
const actorLink = document.querySelector(`a[title="${actorName}" i]`);
return actorLink;
return actorLink ? actorLink.href : null;
}
function scrapeProfile(html, url, actorName) {
@ -157,6 +157,9 @@ function scrapeProfile(html, url, actorName) {
if (bio.Weight) profile.weight = lbsToKg(bio.Weight.match(/\d+/)[0]);
if (bio['Hair Color']) profile.hair = hairMap[bio['Hair Color']] || bio['Hair Color'].toLowerCase();
if (bio['Tits Type'] && bio['Tits Type'].match('Natural')) profile.naturalBoobs = true;
if (bio['Tits Type'] && bio['Tits Type'].match('Enhanced')) profile.naturalBoobs = false;
if (bio['Body Art'] && bio['Body Art'].match('Tattoo')) profile.hasTattoos = true;
if (bio['Body Art'] && bio['Body Art'].match('Piercing')) profile.hasPiercings = true;

View File

@ -2,9 +2,10 @@
const bhttp = require('bhttp');
const cheerio = require('cheerio');
const { JSDOM } = require('jsdom');
const moment = require('moment');
// const knex = require('../knex');
const knex = require('../knex');
const { matchTags } = require('../tags');
/* eslint-disable newline-per-chained-call */
@ -105,6 +106,67 @@ async function scrapeScene(html, url, site) {
};
}
async function scrapeProfile(html, _url, actorName) {
const { document } = new JSDOM(html).window;
const keys = Array.from(document.querySelectorAll('.about-title'), el => el.textContent.trim().replace(':', ''));
const values = Array.from(document.querySelectorAll('.about-info'), (el) => {
if (el.children.length > 0) {
return Array.from(el.children, child => child.textContent.trim()).join(', ');
}
return el.textContent.trim();
});
const bio = keys.reduce((acc, key, index) => {
if (values[index] === '-') {
return acc;
}
return {
...acc,
[key]: values[index],
};
}, {});
const descriptionEl = document.querySelector('.description-box');
const avatarEl = document.querySelector('.pornstar-details .card-img-top');
const country = await knex('countries')
.where('nationality', 'ilike', `%${bio.Nationality}%`)
.orderBy('priority', 'desc')
.first();
const profile = {
name: actorName,
};
profile.birthdate = moment.utc(bio.Birthday, 'MMMM DD, YYYY').toDate();
if (country) profile.birthPlace = country.name;
if (bio['Bra size']) [profile.bust] = bio['Bra size'].match(/\d+\w+/);
if (bio.Waist) profile.waist = Number(bio.Waist.match(/\d+/)[0]);
if (bio.Hips) profile.hip = Number(bio.Hips.match(/\d+/)[0]);
if (bio.Height) profile.height = Number(bio.Height.match(/\d{2,}/)[0]);
if (bio['Tit Style'] && bio['Tit Style'].match('Enhanced')) profile.naturalBoobs = false;
if (bio['Tit Style'] && bio['Tit Style'].match('Natural')) profile.naturalBoobs = true;
if (bio['Body Art'] && bio['Body Art'].match('Tattoo')) profile.hasTattoos = true;
if (bio['Body Art'] && bio['Body Art'].match('Piercing')) profile.hasPiercings = true;
if (bio['Hair Style']) profile.hair = bio['Hair Style'].split(',')[0].trim().toLowerCase();
if (bio['Eye Color']) profile.eyes = bio['Eye Color'].match(/\w+/)[0].toLowerCase();
if (bio['Shoe size']) profile.shoes = Number(bio['Shoe size'].split('|')[1]);
if (descriptionEl) profile.description = descriptionEl.textContent.trim();
if (avatarEl) profile.avatar = `https:${avatarEl.dataset.src}`;
return profile;
}
async function fetchLatest(site, page = 1) {
const res = await bhttp.get(`https://ddfnetwork.com/videos/search/latest/ever/${new URL(site.url).hostname}/-/${page}`);
@ -117,7 +179,41 @@ async function fetchScene(url, site) {
return scrapeScene(res.body.toString(), url, site);
}
async function fetchProfile(actorName) {
const resSearch = await bhttp.post('https://ddfnetwork.com/search/ajax',
{
type: 'hints',
word: actorName,
},
{
decodeJSON: true,
headers: {
'x-requested-with': 'XMLHttpRequest',
},
});
if (resSearch.statusCode !== 200 || Array.isArray(resSearch.body.list)) {
return null;
}
if (!resSearch.body.list.pornstarsName || resSearch.body.list.pornstarsName.length === 0) {
return null;
}
const [actor] = resSearch.body.list.pornstarsName;
const url = `https://ddfnetwork.com${actor.href}`;
const resActor = await bhttp.get(url);
if (resActor.statusCode !== 200) {
return null;
}
return scrapeProfile(resActor.body.toString(), url, actorName);
}
module.exports = {
fetchLatest,
fetchProfile,
fetchScene,
};

View File

@ -4,7 +4,6 @@
const twentyonesextury = require('./21sextury');
const bangbros = require('./bangbros');
const blowpass = require('./blowpass');
const ddfnetwork = require('./ddfnetwork');
const dogfart = require('./dogfart');
const evilangel = require('./evilangel');
const kink = require('./kink');
@ -15,12 +14,13 @@ const privateNetwork = require('./private'); // reserved keyword
const naughtyamerica = require('./naughtyamerica');
const realitykings = require('./realitykings');
const vixen = require('./vixen');
const xempire = require('./xempire');
// releases and profiles
const ddfnetwork = require('./ddfnetwork');
const brazzers = require('./brazzers');
const julesjordan = require('./julesjordan');
const legalporno = require('./legalporno');
const xempire = require('./xempire');
// profiles
const freeones = require('./freeones');
@ -49,10 +49,13 @@ module.exports = {
xempire,
},
actors: {
// ordered by data priority
xempire,
brazzers,
freeones,
julesjordan,
legalporno,
pornhub,
ddfnetwork,
},
};

View File

@ -3,9 +3,10 @@
const Promise = require('bluebird');
const bhttp = require('bhttp');
const cheerio = require('cheerio');
const { JSDOM } = require('jsdom');
const moment = require('moment');
const knex = require('../knex');
const { fetchSites } = require('../sites');
const { matchTags } = require('../tags');
const pluckPhotos = require('../utils/pluck-photos');
@ -142,7 +143,7 @@ async function scrapeScene(html, url, site) {
const duration = moment.duration(data.duration.slice(2).split(':')).asSeconds();
const siteDomain = $('meta[name="twitter:domain"]').attr('content');
const siteId = siteDomain && siteDomain.split('.')[0].toLowerCase();
const siteSlug = siteDomain && siteDomain.split('.')[0].toLowerCase();
const siteUrl = siteDomain && `https://www.${siteDomain}`;
const poster = videoData.picPreview;
@ -152,14 +153,14 @@ async function scrapeScene(html, url, site) {
const rawTags = data.keywords.split(', ');
const [channelSite, tags] = await Promise.all([
const [[channelSite], tags] = await Promise.all([
site.isFallback
? knex('sites')
.where({ url: siteUrl })
.orWhere({ slug: siteId })
.first()
: site,
matchTags([...defaultTags[siteId], ...rawTags]),
? fetchSites({
url: siteUrl,
slug: siteSlug,
})
: [site],
matchTags([...defaultTags[siteSlug], ...rawTags]),
]);
return {
@ -185,6 +186,31 @@ async function scrapeScene(html, url, site) {
};
}
function scrapeActorSearch(html, url, actorName) {
const { document } = new JSDOM(html).window;
const actorLink = document.querySelector(`a[title="${actorName}" i]`);
return actorLink ? actorLink.href : null;
}
function scrapeProfile(html, url, actorName) {
const { document } = new JSDOM(html).window;
const avatarEl = document.querySelector('img.actorPicture');
const descriptionEl = document.querySelector('.actorBio p:not(.bioTitle)');
const profile = {
name: actorName,
};
if (avatarEl) profile.avatar = avatarEl.src;
if (descriptionEl) profile.description = descriptionEl.textContent.trim();
profile.releases = Array.from(document.querySelectorAll('.sceneList .scene a.imgLink'), el => `https://xempire.com${el.href}`);
return profile;
}
async function fetchLatest(site, page = 1) {
const res = await bhttp.get(`${site.url}/en/videos/AllCategories/0/${page}`);
@ -203,8 +229,34 @@ async function fetchScene(url, site) {
return scrapeScene(res.body.toString(), url, site);
}
async function fetchProfile(actorName) {
const actorSlug = actorName.toLowerCase().replace(/\s+/, '+');
const searchUrl = `https://www.xempire.com/en/search/xempire/actor/${actorSlug}`;
const searchRes = await bhttp.get(searchUrl);
if (searchRes.statusCode !== 200) {
return null;
}
const actorUrl = scrapeActorSearch(searchRes.body.toString(), searchUrl, actorName);
if (actorUrl) {
const url = `https://xempire.com${actorUrl}`;
const actorRes = await bhttp.get(url);
if (actorRes.statusCode !== 200) {
return null;
}
return scrapeProfile(actorRes.body.toString(), url, actorName);
}
return null;
}
module.exports = {
fetchLatest,
fetchProfile,
fetchUpcoming,
fetchScene,
};

View File

@ -1,11 +1,17 @@
'use strict';
function whereOr(query, table, builder) {
if (!query) {
return {};
}
Object.entries(query).forEach(([key, value]) => {
if (value !== undefined) {
builder.orWhere(`${table}.${key}`, value);
}
});
return builder;
}
module.exports = whereOr;

View File

@ -6,11 +6,23 @@ async function fetchActorsApi(req, res) {
const actorId = typeof req.params.actorId === 'number' ? req.params.actorId : null;
const actorSlug = typeof req.params.actorId === 'string' ? req.params.actorId : null;
if (actorId || actorSlug) {
const actors = await fetchActors({
id: actorId,
slug: actorSlug,
});
if (actors.length > 0) {
res.send(actors[0]);
return;
}
res.status(404).send();
return;
}
const actors = await fetchActors();
res.send(actors);
}