Configured Reality Kings to fetch session from RK scene overview.

This commit is contained in:
DebaucheryLibrarian 2022-02-11 22:14:44 +01:00
parent 98a72a4929
commit 496c29e569
11 changed files with 157 additions and 64 deletions

View File

@ -6,7 +6,7 @@
<div class="actor-header"> <div class="actor-header">
<h2 class="header-name"> <h2 class="header-name">
<span v-if="actor.entity">{{ actor.name }} ({{ actor.entity.name }})</span> <span v-if="actor.entity">{{ actor.name }} ({{ actor.entity.name }})</span>
<span v-else="">{{ actor.name }}</span> <span v-else>{{ actor.name }}</span>
<Gender <Gender
:gender="actor.gender" :gender="actor.gender"

View File

@ -18,19 +18,16 @@
<div class="filters"> <div class="filters">
<ActorFilter <ActorFilter
class="filters-filter" class="filters-filter"
:filter="filter"
:available-actors="availableActors" :available-actors="availableActors"
/> />
<ChannelFilter <ChannelFilter
class="filters-filter" class="filters-filter"
:filter="filter"
:available-channels="availableChannels" :available-channels="availableChannels"
/> />
<TagFilter <TagFilter
class="filters-filter" class="filters-filter"
:filter="filter"
:available-tags="availableTags" :available-tags="availableTags"
/> />
</div> </div>
@ -44,10 +41,6 @@ import ActorFilter from './actor-filter.vue';
import ChannelFilter from './channel-filter.vue'; import ChannelFilter from './channel-filter.vue';
import TagFilter from './tag-filter.vue'; import TagFilter from './tag-filter.vue';
function filter(state) {
return state.ui.filter;
}
function range() { function range() {
return this.$route.params.range; return this.$route.params.range;
} }
@ -114,7 +107,6 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
filter,
range, range,
batch, batch,
}), }),
@ -129,6 +121,43 @@ export default {
<style lang="scss"> <style lang="scss">
@import 'breakpoints'; @import 'breakpoints';
.filter {
color: var(--shadow);
display: inline-flex;
align-items: center;
.filter-applied {
flex-grow: 1;
padding: .75rem .5rem;
font-size: 1rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
&.empty {
color: var(--shadow);
}
}
.icon {
fill: var(--shadow);
margin: -.1rem 0 0 0;
}
&:hover {
cursor: pointer;
.applied {
color: var(--shadow-strong);
}
.icon {
fill: var(--shadow-strong);
}
}
}
.filter-mode { .filter-mode {
width: 100%; width: 100%;
color: var(--shadow); color: var(--shadow);
@ -274,43 +303,6 @@ export default {
} }
} }
::v-deep(.filter) {
color: var(--shadow);
display: inline-flex;
align-items: center;
.filter-applied {
flex-grow: 1;
padding: .75rem .5rem;
font-size: 1rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
&.empty {
color: var(--shadow);
}
}
.icon {
fill: var(--shadow);
margin: -.1rem 0 0 0;
}
&:hover {
cursor: pointer;
.applied {
color: var(--shadow-strong);
}
.icon {
fill: var(--shadow-strong);
}
}
}
.filters { .filters {
flex-shrink: 0; flex-shrink: 0;
} }

View File

@ -14,7 +14,7 @@
>Tags</div> >Tags</div>
</div> </div>
<template v-slot:tooltip> <template #tooltip>
<div <div
class="filter-options" class="filter-options"
@click.stop @click.stop
@ -70,7 +70,7 @@
<script> <script>
function getNewRange(tag) { function getNewRange(tag) {
if (this.selectedTags.includes(tag)) { if (this.selectedTags.includes(tag)) {
return { tags: this.selectedTags.filter(selectedTag => selectedTag !== tag).join(',') || undefined }; return { tags: this.selectedTags.filter((selectedTag) => selectedTag !== tag).join(',') || undefined };
} }
return { tags: this.selectedTags.concat(tag).join(',') }; return { tags: this.selectedTags.concat(tag).join(',') };
@ -82,10 +82,6 @@ function selectedTags() {
export default { export default {
props: { props: {
filter: {
type: Array,
default: () => [],
},
compact: { compact: {
type: Boolean, type: Boolean,
default: false, default: false,

View File

@ -3,6 +3,12 @@
<div class="content-inner"> <div class="content-inner">
<SearchBar :placeholder="`Search ${totalCount} movies`" /> <SearchBar :placeholder="`Search ${totalCount} movies`" />
<TagFilter
class="filters-filter"
:filter="filter"
:available-tags="availableTags"
/>
<div <div
ref="tiles" ref="tiles"
class="tiles" class="tiles"
@ -30,6 +36,7 @@
import MovieTile from './movie-tile.vue'; import MovieTile from './movie-tile.vue';
import SearchBar from '../search/bar.vue'; import SearchBar from '../search/bar.vue';
import Pagination from '../pagination/pagination.vue'; import Pagination from '../pagination/pagination.vue';
import TagFilter from '../filters/tag-filter.vue';
async function fetchMovies() { async function fetchMovies() {
if (this.$route.query.query) { if (this.$route.query.query) {
@ -73,6 +80,7 @@ export default {
MovieTile, MovieTile,
SearchBar, SearchBar,
Pagination, Pagination,
TagFilter,
}, },
data() { data() {
return { return {

View File

@ -0,0 +1,8 @@
exports.up = async (knex) => knex.raw(`
CREATE VIEW movies_tagged AS
SELECT * FROM movies;
`);
exports.down = async (knex) => knex.raw(`
DROP VIEW IF EXISTS movies_tagged;
`);

35
package-lock.json generated
View File

@ -57,6 +57,7 @@
"mitt": "^3.0.0", "mitt": "^3.0.0",
"moment": "^2.24.0", "moment": "^2.24.0",
"nanoid": "^3.1.30", "nanoid": "^3.1.30",
"node-fetch": "^2.6.7",
"object-merge-advanced": "^12.1.0", "object-merge-advanced": "^12.1.0",
"object.omit": "^3.0.0", "object.omit": "^3.0.0",
"opn": "^6.0.0", "opn": "^6.0.0",
@ -72,6 +73,7 @@
"tippy.js": "^6.3.1", "tippy.js": "^6.3.1",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
"undici": "^4.13.0",
"url-pattern": "^1.0.3", "url-pattern": "^1.0.3",
"v-tooltip": "^2.0.3", "v-tooltip": "^2.0.3",
"video.js": "^7.11.4", "video.js": "^7.11.4",
@ -11611,14 +11613,22 @@
"integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q==" "integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q=="
}, },
"node_modules/node-fetch": { "node_modules/node-fetch": {
"version": "2.6.5", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": { "dependencies": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
}, },
"engines": { "engines": {
"node": "4.x || >=6.0.0" "node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
} }
}, },
"node_modules/node-fetch/node_modules/tr46": { "node_modules/node-fetch/node_modules/tr46": {
@ -16346,6 +16356,14 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/undici": {
"version": "4.13.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-4.13.0.tgz",
"integrity": "sha512-8lk8S/f2V0VUNGf2scU2b+KI2JSzEQLdCyRNRF3XmHu+5jectlSDaPSBCXAHFaUlt1rzngzOBVDgJS9/Gue/KA==",
"engines": {
"node": ">=12.18"
}
},
"node_modules/unicode-canonical-property-names-ecmascript": { "node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
@ -26407,9 +26425,9 @@
"integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q==" "integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q=="
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.5", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": { "requires": {
"whatwg-url": "^5.0.0" "whatwg-url": "^5.0.0"
}, },
@ -30068,6 +30086,11 @@
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo="
}, },
"undici": {
"version": "4.13.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-4.13.0.tgz",
"integrity": "sha512-8lk8S/f2V0VUNGf2scU2b+KI2JSzEQLdCyRNRF3XmHu+5jectlSDaPSBCXAHFaUlt1rzngzOBVDgJS9/Gue/KA=="
},
"unicode-canonical-property-names-ecmascript": { "unicode-canonical-property-names-ecmascript": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",

View File

@ -116,6 +116,7 @@
"mitt": "^3.0.0", "mitt": "^3.0.0",
"moment": "^2.24.0", "moment": "^2.24.0",
"nanoid": "^3.1.30", "nanoid": "^3.1.30",
"node-fetch": "^2.6.7",
"object-merge-advanced": "^12.1.0", "object-merge-advanced": "^12.1.0",
"object.omit": "^3.0.0", "object.omit": "^3.0.0",
"opn": "^6.0.0", "opn": "^6.0.0",
@ -131,6 +132,7 @@
"tippy.js": "^6.3.1", "tippy.js": "^6.3.1",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"tunnel": "0.0.6", "tunnel": "0.0.6",
"undici": "^4.13.0",
"url-pattern": "^1.0.3", "url-pattern": "^1.0.3",
"v-tooltip": "^2.0.3", "v-tooltip": "^2.0.3",
"video.js": "^7.11.4", "video.js": "^7.11.4",

View File

@ -512,6 +512,10 @@ const networks = [
url: 'https://www.realitykings.com', url: 'https://www.realitykings.com',
description: 'Home of HD reality porn featuring the nicest tits and ass online! The hottest curvy girls in real amateur sex stories are only on REALITYkings.com', description: 'Home of HD reality porn featuring the nicest tits and ass online! The hottest curvy girls in real amateur sex stories are only on REALITYkings.com',
parent: 'mindgeek', parent: 'mindgeek',
parameters: {
childSession: true,
parentSession: false,
},
}, },
{ {
slug: 'score', slug: 'score',

View File

@ -155,8 +155,8 @@ function getUrl(site) {
throw new Error(`Mind Geek site '${site.name}' (${site.url}) not supported`); throw new Error(`Mind Geek site '${site.name}' (${site.url}) not supported`);
} }
async function getSession(site, parameters) { async function getSession(site, parameters, url) {
if (site.slug === 'mindgeek') { if (site.slug === 'mindgeek' || site.parameters?.parentSession === false) {
// most MG sites have a parent network to acquire a session from, don't try to acquire session from mindgeek.com for independent channels // most MG sites have a parent network to acquire a session from, don't try to acquire session from mindgeek.com for independent channels
return null; return null;
} }
@ -166,7 +166,7 @@ async function getSession(site, parameters) {
const sessionUrl = site.parameters?.siteId && !(site.parameters?.native || site.parameters?.childSession || site.parent?.parameters?.childSession) const sessionUrl = site.parameters?.siteId && !(site.parameters?.native || site.parameters?.childSession || site.parent?.parameters?.childSession)
? site.parent.url ? site.parent.url
: site.url; : (url || site.url);
const res = await http.get(sessionUrl, { const res = await http.get(sessionUrl, {
session, session,
@ -179,8 +179,10 @@ async function getSession(site, parameters) {
const cookieString = await cookieJar.getCookieStringAsync(sessionUrl); const cookieString = await cookieJar.getCookieStringAsync(sessionUrl);
const { instance_token: instanceToken } = cookie.parse(cookieString); const { instance_token: instanceToken } = cookie.parse(cookieString);
if (instanceToken) {
return { session, instanceToken }; return { session, instanceToken };
} }
}
throw new Error(`Failed to acquire MindGeek session (${res.statusCode})`); throw new Error(`Failed to acquire MindGeek session (${res.statusCode})`);
} }
@ -238,7 +240,9 @@ async function fetchLatest(site, page = 1, options) {
const { searchParams } = new URL(url); const { searchParams } = new URL(url);
const siteId = searchParams.get('site'); const siteId = searchParams.get('site');
const { session, instanceToken } = options.beforeNetwork?.headers?.Instance ? options.beforeNetwork : await getSession(site, options.parameters); const { session, instanceToken } = options.beforeNetwork?.headers?.Instance
? options.beforeNetwork
: await getSession(site, options.parameters, url);
const beforeDate = moment().add('1', 'day').format('YYYY-MM-DD'); const beforeDate = moment().add('1', 'day').format('YYYY-MM-DD');
const limit = 24; const limit = 24;
@ -366,6 +370,7 @@ async function fetchProfile({ name: actorName, slug: actorSlug }, { entity, para
module.exports = { module.exports = {
beforeNetwork: getSession, beforeNetwork: getSession,
beforeFetchScenes: getSession, beforeFetchScenes: getSession,
requireBeforeNetwork: false,
scrapeLatestX, scrapeLatestX,
fetchLatest, fetchLatest,
fetchUpcoming, fetchUpcoming,

43
src/tools/realitykings.js Normal file
View File

@ -0,0 +1,43 @@
'use strict';
const https = require('https');
const bhttp = require('bhttp');
const fetch = require('node-fetch');
const { request } = require('undici');
const express = require('express');
async function init() {
const res = await fetch('https://www.realitykings.com/scenes?site=45', {
method: 'HEAD',
headers: {
'user-agent': 'HTTPie/2.6.0',
'accept-encoding': 'gzip, deflate, br',
accept: '*/*',
connection: 'keep-alive',
},
});
console.log(res.status, res.headers);
const app = express();
app.get('/', (appReq, appRes) => {
console.log(appReq.headers);
appRes.status(204).send();
});
app.listen(8000, () => {
console.log('Listening on port 8000');
fetch('http://127.0.0.1:8000', {
headers: {
'user-agent': 'HTTPie/2.6.0',
'accept-encoding': 'gzip, deflate, br',
accept: '*/*',
connection: 'keep-alive',
},
});
});
}
init();

View File

@ -267,8 +267,20 @@ async function scrapeNetworkSequential(networkEntity) {
return releases.uniqueReleases; return releases.uniqueReleases;
} }
async function getBeforeNetwork(networkEntity) {
try {
return await networkEntity.scraper?.beforeNetwork?.(networkEntity);
} catch (error) {
if (networkEntity.scraper?.requireBeforeNetwork === false) {
return null;
}
throw error;
}
}
async function scrapeNetworkParallel(networkEntity) { async function scrapeNetworkParallel(networkEntity) {
const beforeNetwork = await networkEntity.scraper?.beforeNetwork?.(networkEntity); const beforeNetwork = await getBeforeNetwork(networkEntity);
return Promise.map( return Promise.map(
networkEntity.includedChildren, networkEntity.includedChildren,