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">
<h2 class="header-name">
<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="actor.gender"

View File

@ -18,19 +18,16 @@
<div class="filters">
<ActorFilter
class="filters-filter"
:filter="filter"
:available-actors="availableActors"
/>
<ChannelFilter
class="filters-filter"
:filter="filter"
:available-channels="availableChannels"
/>
<TagFilter
class="filters-filter"
:filter="filter"
:available-tags="availableTags"
/>
</div>
@ -44,10 +41,6 @@ import ActorFilter from './actor-filter.vue';
import ChannelFilter from './channel-filter.vue';
import TagFilter from './tag-filter.vue';
function filter(state) {
return state.ui.filter;
}
function range() {
return this.$route.params.range;
}
@ -114,7 +107,6 @@ export default {
},
computed: {
...mapState({
filter,
range,
batch,
}),
@ -129,6 +121,43 @@ export default {
<style lang="scss">
@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 {
width: 100%;
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 {
flex-shrink: 0;
}

View File

@ -14,7 +14,7 @@
>Tags</div>
</div>
<template v-slot:tooltip>
<template #tooltip>
<div
class="filter-options"
@click.stop
@ -70,7 +70,7 @@
<script>
function getNewRange(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(',') };
@ -82,10 +82,6 @@ function selectedTags() {
export default {
props: {
filter: {
type: Array,
default: () => [],
},
compact: {
type: Boolean,
default: false,

View File

@ -3,6 +3,12 @@
<div class="content-inner">
<SearchBar :placeholder="`Search ${totalCount} movies`" />
<TagFilter
class="filters-filter"
:filter="filter"
:available-tags="availableTags"
/>
<div
ref="tiles"
class="tiles"
@ -30,6 +36,7 @@
import MovieTile from './movie-tile.vue';
import SearchBar from '../search/bar.vue';
import Pagination from '../pagination/pagination.vue';
import TagFilter from '../filters/tag-filter.vue';
async function fetchMovies() {
if (this.$route.query.query) {
@ -73,6 +80,7 @@ export default {
MovieTile,
SearchBar,
Pagination,
TagFilter,
},
data() {
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",
"moment": "^2.24.0",
"nanoid": "^3.1.30",
"node-fetch": "^2.6.7",
"object-merge-advanced": "^12.1.0",
"object.omit": "^3.0.0",
"opn": "^6.0.0",
@ -72,6 +73,7 @@
"tippy.js": "^6.3.1",
"tough-cookie": "^4.0.0",
"tunnel": "0.0.6",
"undici": "^4.13.0",
"url-pattern": "^1.0.3",
"v-tooltip": "^2.0.3",
"video.js": "^7.11.4",
@ -11611,14 +11613,22 @@
"integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q=="
},
"node_modules/node-fetch": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-fetch/node_modules/tr46": {
@ -16346,6 +16356,14 @@
"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": {
"version": "2.0.0",
"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=="
},
"node-fetch": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
},
@ -30068,6 +30086,11 @@
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
"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": {
"version": "2.0.0",
"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",
"moment": "^2.24.0",
"nanoid": "^3.1.30",
"node-fetch": "^2.6.7",
"object-merge-advanced": "^12.1.0",
"object.omit": "^3.0.0",
"opn": "^6.0.0",
@ -131,6 +132,7 @@
"tippy.js": "^6.3.1",
"tough-cookie": "^4.0.0",
"tunnel": "0.0.6",
"undici": "^4.13.0",
"url-pattern": "^1.0.3",
"v-tooltip": "^2.0.3",
"video.js": "^7.11.4",

View File

@ -512,6 +512,10 @@ const networks = [
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',
parent: 'mindgeek',
parameters: {
childSession: true,
parentSession: false,
},
},
{
slug: 'score',

View File

@ -155,8 +155,8 @@ function getUrl(site) {
throw new Error(`Mind Geek site '${site.name}' (${site.url}) not supported`);
}
async function getSession(site, parameters) {
if (site.slug === 'mindgeek') {
async function getSession(site, parameters, url) {
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
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)
? site.parent.url
: site.url;
: (url || site.url);
const res = await http.get(sessionUrl, {
session,
@ -179,8 +179,10 @@ async function getSession(site, parameters) {
const cookieString = await cookieJar.getCookieStringAsync(sessionUrl);
const { instance_token: instanceToken } = cookie.parse(cookieString);
if (instanceToken) {
return { session, instanceToken };
}
}
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 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 limit = 24;
@ -366,6 +370,7 @@ async function fetchProfile({ name: actorName, slug: actorSlug }, { entity, para
module.exports = {
beforeNetwork: getSession,
beforeFetchScenes: getSession,
requireBeforeNetwork: false,
scrapeLatestX,
fetchLatest,
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;
}
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) {
const beforeNetwork = await networkEntity.scraper?.beforeNetwork?.(networkEntity);
const beforeNetwork = await getBeforeNetwork(networkEntity);
return Promise.map(
networkEntity.includedChildren,