Compare commits
No commits in common. "d6c6c3435d9ff017cdec118ef5085eb46ae26408" and "10ba67fde1d9d13099feb1b0e88477bd7ce4bd50" have entirely different histories.
d6c6c3435d
...
10ba67fde1
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.228.29",
|
||||
"version": "1.228.28",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "traxxx",
|
||||
"version": "1.228.29",
|
||||
"version": "1.228.28",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@casl/ability": "^5.2.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.228.29",
|
||||
"version": "1.228.28",
|
||||
"description": "All the latest porn releases in one place",
|
||||
"main": "src/app.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -5,7 +5,6 @@ const Promise = require('bluebird');
|
|||
const moment = require('moment');
|
||||
const unprint = require('unprint');
|
||||
|
||||
const argv = require('../argv');
|
||||
const qu = require('../utils/qu');
|
||||
const http = require('../utils/http');
|
||||
const slugify = require('../utils/slugify');
|
||||
|
@ -260,7 +259,41 @@ async function scrapeSceneData(data, channel, options) {
|
|||
return release;
|
||||
}
|
||||
|
||||
const videoFields = `
|
||||
async function fetchGraphqlScene(release, channel) {
|
||||
const slug = new URL(release.url).pathname.match(/\/videos\/(.*)/)?.[1];
|
||||
|
||||
if (!slug) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// the API won't reliable return results when the query is over ~30 characters for some reason
|
||||
// it may still occasionally fail to return the relevant result, first, such as Blacked Raw - After the Show
|
||||
const query = slug.split('-').reduce((acc, word) => {
|
||||
const newAcc = `${acc} ${word}`;
|
||||
|
||||
if (newAcc.length > 30) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
return newAcc;
|
||||
}, '').trim();
|
||||
|
||||
const res = await http.post(`${channel.url}/graphql`, {
|
||||
operationName: 'searchVideos',
|
||||
variables: {
|
||||
site: channel.slug.toUpperCase(),
|
||||
query,
|
||||
},
|
||||
// ranking can be weird, use higher limit to increase likelihood of finding scene
|
||||
query: `
|
||||
query searchVideos($site: Site!, $query: String!) {
|
||||
searchVideos(input: {
|
||||
query: $query
|
||||
site: $site
|
||||
first: 50
|
||||
}) {
|
||||
edges {
|
||||
node {
|
||||
videoId
|
||||
title
|
||||
slug
|
||||
|
@ -298,52 +331,10 @@ const videoFields = `
|
|||
...ImageInfo
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
function getSlug(release) {
|
||||
if (release.slug) {
|
||||
return release.slug;
|
||||
}
|
||||
|
||||
if (release.url) {
|
||||
return new URL(release.url).pathname.match(/\/videos\/(.*)/)?.[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchGraphqlScene(release, channel) {
|
||||
const slug = getSlug(release);
|
||||
const entryId = argv.entryId || release.entryId;
|
||||
|
||||
if (!entryId && !slug) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const query = entryId
|
||||
? `
|
||||
query searchVideos($videoId: ID!) {
|
||||
video: findOneVideo(input: { videoId: $videoId }) {
|
||||
${videoFields}
|
||||
}
|
||||
}
|
||||
`
|
||||
: `
|
||||
query searchVideos($slug: String!) {
|
||||
video: findOneVideo(input: { slug: $slug }) {
|
||||
${videoFields}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const res = await http.post(`${channel.url}/graphql`, {
|
||||
operationName: 'searchVideos',
|
||||
variables: {
|
||||
videoId: entryId,
|
||||
slug,
|
||||
},
|
||||
query: `
|
||||
${query}
|
||||
|
||||
fragment ImageInfo on Image {
|
||||
src
|
||||
|
@ -362,7 +353,7 @@ async function fetchGraphqlScene(release, channel) {
|
|||
});
|
||||
|
||||
if (res.ok) {
|
||||
return res.body.data.video;
|
||||
return res.body.data?.searchVideos?.edges?.find((edge) => edge.node.slug === slug)?.node || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -565,69 +556,3 @@ module.exports = {
|
|||
fetchScene,
|
||||
fetchProfile,
|
||||
};
|
||||
|
||||
/* less reliable search API in case direct video query becomes unavailable
|
||||
async function findGraphqlScene(release, channel) {
|
||||
const slug = new URL(release.url).pathname.match(/\/videos\/(.*)/)?.[1];
|
||||
|
||||
if (!slug) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// the API won't reliable return results when the query is over ~30 characters for some reason
|
||||
// it may still occasionally fail to return the relevant result, first, such as Blacked Raw - After the Show
|
||||
const query = slug.split('-').reduce((acc, word) => {
|
||||
const newAcc = `${acc} ${word}`;
|
||||
|
||||
if (newAcc.length > 30) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
return newAcc;
|
||||
}, '').trim();
|
||||
|
||||
const res = await http.post(`${channel.url}/graphql`, {
|
||||
operationName: 'searchVideos',
|
||||
variables: {
|
||||
site: channel.slug.toUpperCase(),
|
||||
query,
|
||||
},
|
||||
// ranking can be weird, use higher limit to increase likelihood of finding scene
|
||||
query: `
|
||||
query searchVideos($site: Site!, $query: String!) {
|
||||
searchVideos(input: {
|
||||
query: $query
|
||||
site: $site
|
||||
first: 50
|
||||
}) {
|
||||
edges {
|
||||
node {
|
||||
${videoFields}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment ImageInfo on Image {
|
||||
src
|
||||
width
|
||||
height
|
||||
highdpi {
|
||||
double
|
||||
}
|
||||
}
|
||||
`,
|
||||
}, {
|
||||
headers: {
|
||||
referer: release.url,
|
||||
origin: channel.url,
|
||||
},
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
return res.body.data?.searchVideos?.edges?.find((edge) => edge.node.slug === slug)?.node || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue