forked from DebaucheryLibrarian/traxxx
Added Black for Wife to JayRock. Switched parameters field to JSON type.
This commit is contained in:
@@ -6,6 +6,7 @@ const bhttp = require('bhttp');
|
||||
|
||||
const logger = require('../logger')(__filename);
|
||||
const slugify = require('../utils/slugify');
|
||||
const { fetchApiLatest, fetchScene } = require('./gamma');
|
||||
|
||||
async function fetchToken(site) {
|
||||
const res = await bhttp.get(site.url);
|
||||
@@ -81,6 +82,10 @@ function scrapeLatest(scenes, site, tokens) {
|
||||
}
|
||||
|
||||
async function fetchLatest(site, page = 1) {
|
||||
if (site.parameters?.useGamma) {
|
||||
return fetchApiLatest(site, page);
|
||||
}
|
||||
|
||||
const { time, token } = await fetchToken(site);
|
||||
|
||||
// transParameters[v1] includes _resources, [v2] includes photos, [preset] is mandatory
|
||||
@@ -94,7 +99,11 @@ async function fetchLatest(site, page = 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchScene(url, site, release) {
|
||||
async function fetchNetworkScene(url, site, release) {
|
||||
if (site.parameters?.useGamma) {
|
||||
return fetchScene(url, site, release);
|
||||
}
|
||||
|
||||
const { time, token } = release?.meta.tokens || await fetchToken(site); // use attached tokens when deep fetching
|
||||
const { pathname } = new URL(url);
|
||||
const entryId = pathname.split('/')[2];
|
||||
@@ -111,5 +120,5 @@ async function fetchScene(url, site, release) {
|
||||
|
||||
module.exports = {
|
||||
fetchLatest,
|
||||
fetchScene,
|
||||
fetchScene: fetchNetworkScene,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user