diff --git a/.eslintignore b/.eslintignore index f4416e34..e69de29b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +0,0 @@ -src/scrapers/template.js diff --git a/assets/components/header/header.vue b/assets/components/header/header.vue index 659d396a..4db57f17 100644 --- a/assets/components/header/header.vue +++ b/assets/components/header/header.vue @@ -212,6 +212,7 @@ export default { .sidebar-toggle { display: none; + align-items: center; height: 100%; .logo { diff --git a/assets/components/sidebar/sidebar.vue b/assets/components/sidebar/sidebar.vue index 22737278..ad6b95bd 100644 --- a/assets/components/sidebar/sidebar.vue +++ b/assets/components/sidebar/sidebar.vue @@ -183,7 +183,7 @@ export default { height: 100%; color: var(--text); background: var(--background); - box-shadow: 0 0 3px var(--darken); + box-shadow: 0 0 3px var(--darken-weak); } .sidebar-header { diff --git a/assets/js/actors/actions.js b/assets/js/actors/actions.js index 0a26b4bb..30c2929a 100644 --- a/assets/js/actors/actions.js +++ b/assets/js/actors/actions.js @@ -24,8 +24,8 @@ function initActorActions(store, router) { $actorId: Int! $limit:Int = 10, $offset:Int = 0, - $after:Date = "1900-01-01", - $before:Date = "2100-01-01", + $after:Datetime = "1900-01-01", + $before:Datetime = "2100-01-01", $orderBy:[ReleasesActorsOrderBy!] $selectableTags: [String], $excludeTags: [String!] diff --git a/assets/js/entities/actions.js b/assets/js/entities/actions.js index 3f32254b..d4262bf1 100644 --- a/assets/js/entities/actions.js +++ b/assets/js/entities/actions.js @@ -20,8 +20,8 @@ function initEntitiesActions(store, _router) { $entityType: String! = "channel" $limit: Int = 10, $offset: Int = 0, - $after: Date = "1900-01-01", - $before: Date = "2100-01-01", + $after: Datetime = "1900-01-01", + $before: Datetime = "2100-01-01", $afterTime: Datetime = "1900-01-01", $beforeTime: Datetime = "2100-01-01", $orderBy: [ReleasesOrderBy!] diff --git a/assets/js/releases/actions.js b/assets/js/releases/actions.js index 83a78ca3..6f4a24ef 100644 --- a/assets/js/releases/actions.js +++ b/assets/js/releases/actions.js @@ -11,8 +11,8 @@ function initReleasesActions(store, _router) { query Releases( $limit:Int = 1000, $offset:Int = 0, - $after:Date = "1900-01-01", - $before:Date = "2100-01-01", + $after:Datetime = "1900-01-01", + $before:Datetime = "2100-01-01", $orderBy:[ReleasesOrderBy!], $exclude: [String!] ) { diff --git a/assets/js/tags/actions.js b/assets/js/tags/actions.js index e79ebc15..8dceb136 100644 --- a/assets/js/tags/actions.js +++ b/assets/js/tags/actions.js @@ -13,8 +13,8 @@ function initTagsActions(store, _router) { query Tag( $tagSlug:String! $limit:Int = 1000, - $after:Date = "1900-01-01", - $before:Date = "2100-01-01", + $after:Datetime = "1900-01-01", + $before:Datetime = "2100-01-01", $orderBy: [ReleasesTagsOrderBy!], $exclude: [String!] ) { diff --git a/src/actors.js b/src/actors.js index 6a1cd64f..5f4f0ae4 100644 --- a/src/actors.js +++ b/src/actors.js @@ -505,6 +505,8 @@ async function scrapeProfiles(actor, sources, entitiesBySlug, existingProfilesBy try { const scraper = scrapers[scraperSlug]; const context = { + ...entitiesBySlug[scraperSlug], + // legacy site: entitiesBySlug[scraperSlug] || null, network: entitiesBySlug[scraperSlug] || null, entity: entitiesBySlug[scraperSlug] || null, diff --git a/src/scrapers/scrapers.js b/src/scrapers/scrapers.js index d77532a8..08c213bb 100644 --- a/src/scrapers/scrapers.js +++ b/src/scrapers/scrapers.js @@ -15,6 +15,7 @@ const cherrypimps = require('./cherrypimps'); const ddfnetwork = require('./ddfnetwork'); const digitalplayground = require('./digitalplayground'); const dogfart = require('./dogfart'); +const elegantangel = require('./elegantangel'); const evilangel = require('./evilangel'); const fakehub = require('./fakehub'); const famedigital = require('./famedigital'); @@ -90,6 +91,7 @@ module.exports = { digitalplayground, dogfart, dogfartnetwork: dogfart, + elegantangel, evilangel, fakehub, famedigital, diff --git a/src/scrapers/template.js b/src/scrapers/template.js index fae753e5..e72475dc 100644 --- a/src/scrapers/template.js +++ b/src/scrapers/template.js @@ -1,51 +1,97 @@ 'use strict'; -const { get, geta } = require('../utils/q'); +const qu = require('../utils/q'); +const slugify = require('../utils/slugify'); -function scrapeLatest(scenes, site) { - return scenes.map(({ qu }) => { - const release = {}; +function scrapeAll(scenes, site) { + return scenes.map(({ query }) => { + const release = {}; + const pathname = query.url('.title a'); - release.title = qu.q('.title a', true); + release.entryId = pathname.match(/\/scene\/(\d+)/)[1]; + release.url = `${site.url}${pathname}`; - const pathname = qu.url('.title a'); - release.entryId = pathname.split('/')[3]; - release.url = `${site.url}${pathname}`; + release.title = query.cnt('.title a'); + release.description = query.cnt('.description'); - release.date = qu.date('.date', 'MMM DD, YYYY'); - release.actors = qu.all('.models a.model', true); + release.date = query.date('.date', 'MMM DD, YYYY'); + release.actors = query.cnts('.models a.model'); - release.poster = qu.q('img').dataset.original; + release.poster = query.q('img.poster'); - release.stars = Number(qu.q('.rating', true)); - release.likes = Number(qu.q('.likes', true)); + release.stars = query.number('.rating'); + release.likes = query.number('.likes'); - console.log(release); - return release; - }); + console.log(release); + return release; + }); } -function scrapeScene({ qu }, _site) { - const release = {}; +function scrapeScene({ query }) { + const release = {}; - console.log(release); - return release; + release.title = query.cnt('h3.title'); + release.description = query.cnt('p.description'); + + [release.poster, ...release.photos] = query.imgs('.preview-thumb'); + + const trailer = query.video('.trailer video'); + release.trailer = { src: trailer }; + + console.log(release); + return release; } -async function fetchLatest(site, page = 1) { - const url = `${site.url}/${page}`; - const res = await geta(url, '.selector'); +function scrapeProfile({ query, el }, actorName, entity, include) { + const profile = {}; - return res.ok ? scrapeLatest(res.items, site) : res.status; + profile.description = query.cnt('.bio-text'); + profile.birthPlace = query.cnt('.birth-place span'); + + profile.avatar = query.img('.actor-photo img'); + + if (include.releases) { + return scrapeAll(qu.initAll(el, '.scene')); + } + + console.log(profile); + return profile; } -async function fetchScene(url, site) { - const res = await get(url); +async function fetchLatest(channel, page = 1) { + const url = `${channel.url}/${page}`; + const res = await qu.getAll(url, '.scene'); - return res.ok ? scrapeScene(res.item, site) : res.status; + if (res.ok) { + return scrapeAll(res.items, channel); + } + + return res.status; +} + +async function fetchScene(url, channel) { + const res = await qu.get(url); + + if (res.ok) { + return scrapeScene(res.item, channel); + } + + return res.status; +} + +async function fetchProfile(actorName, entity, include) { + const url = `${entity.url}/actors/${slugify(actorName, '_')}`; + const res = await qu.get(url); + + if (res.ok) { + return scrapeProfile(res.item, actorName, entity, include); + } + + return res.status; } module.exports = { - fetchLatest, - fetchScene, + fetchLatest, + fetchScene, + fetchProfile, };