Using API to fetch Aziani block IDs, fixed block IDs were incorrect interpretation.
This commit is contained in:
9
package-lock.json
generated
9
package-lock.json
generated
@@ -94,7 +94,7 @@
|
|||||||
"tunnel": "0.0.6",
|
"tunnel": "0.0.6",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"undici": "^5.28.1",
|
"undici": "^5.28.1",
|
||||||
"unprint": "^0.18.32",
|
"unprint": "^0.18.33",
|
||||||
"url-pattern": "^1.0.3",
|
"url-pattern": "^1.0.3",
|
||||||
"v-tooltip": "^2.1.3",
|
"v-tooltip": "^2.1.3",
|
||||||
"video.js": "^8.6.1",
|
"video.js": "^8.6.1",
|
||||||
@@ -20385,9 +20385,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unprint": {
|
"node_modules/unprint": {
|
||||||
"version": "0.18.32",
|
"version": "0.18.33",
|
||||||
"resolved": "https://registry.npmjs.org/unprint/-/unprint-0.18.32.tgz",
|
"resolved": "https://registry.npmjs.org/unprint/-/unprint-0.18.33.tgz",
|
||||||
"integrity": "sha512-3AOeu6vvAqJfxfYGJl/AUO07qnfFKbyyFpZzSBFwQJ+bZgU+kBX1uaj/4TD3ayBHkMgqRDYObJuGRQMZ6Xdncg==",
|
"integrity": "sha512-SCVWfYCou5aUXxJOFaG2LOmhRB+NO5ZxyO4gnpS2iUCb7vKpEgAqpgux5kL8AX0vg7Uhir8+X/Z4c/6tsLhUVQ==",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bottleneck": "^2.19.5",
|
"bottleneck": "^2.19.5",
|
||||||
"cookie": "^1.1.1",
|
"cookie": "^1.1.1",
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
"tunnel": "0.0.6",
|
"tunnel": "0.0.6",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"undici": "^5.28.1",
|
"undici": "^5.28.1",
|
||||||
"unprint": "^0.18.32",
|
"unprint": "^0.18.33",
|
||||||
"url-pattern": "^1.0.3",
|
"url-pattern": "^1.0.3",
|
||||||
"v-tooltip": "^2.1.3",
|
"v-tooltip": "^2.1.3",
|
||||||
"video.js": "^8.6.1",
|
"video.js": "^8.6.1",
|
||||||
|
|||||||
@@ -1325,7 +1325,6 @@ const sites = [
|
|||||||
seriesId: 268,
|
seriesId: 268,
|
||||||
// areaId: 3,
|
// areaId: 3,
|
||||||
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
||||||
blockId: 114458,
|
|
||||||
scene: 'https://aziani.com',
|
scene: 'https://aziani.com',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1338,9 +1337,7 @@ const sites = [
|
|||||||
parameters: {
|
parameters: {
|
||||||
// areaId: 2,
|
// areaId: 2,
|
||||||
areaId: '4f0a134f-8a1b-4bcb-8013-7e02fac4f61d',
|
areaId: '4f0a134f-8a1b-4bcb-8013-7e02fac4f61d',
|
||||||
blockId: 114064,
|
|
||||||
seriesId: 107,
|
seriesId: 107,
|
||||||
modelBlockId: 114129,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1351,10 +1348,9 @@ const sites = [
|
|||||||
independent: true,
|
independent: true,
|
||||||
parameters: {
|
parameters: {
|
||||||
// areaId: 11,
|
// areaId: 11,
|
||||||
|
videos: '/creampiled-videos',
|
||||||
areaId: '29c61dae-db14-419b-93a4-d016b928dee9',
|
areaId: '29c61dae-db14-419b-93a4-d016b928dee9',
|
||||||
blockId: 115990,
|
|
||||||
seriesId: 436,
|
seriesId: 436,
|
||||||
modelBlockId: 115345,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1366,7 +1362,6 @@ const sites = [
|
|||||||
parameters: {
|
parameters: {
|
||||||
// areaId: 8,
|
// areaId: 8,
|
||||||
areaId: 'ae0a26fe-7f08-433d-bb04-a9b6f358c48e',
|
areaId: 'ae0a26fe-7f08-433d-bb04-a9b6f358c48e',
|
||||||
blockId: 116531,
|
|
||||||
seriesId: 395,
|
seriesId: 395,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1378,7 +1373,6 @@ const sites = [
|
|||||||
parameters: {
|
parameters: {
|
||||||
// areaId: 3,
|
// areaId: 3,
|
||||||
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
||||||
blockId: 114458,
|
|
||||||
seriesId: 105,
|
seriesId: 105,
|
||||||
scene: 'https://aziani.com',
|
scene: 'https://aziani.com',
|
||||||
},
|
},
|
||||||
@@ -1392,7 +1386,6 @@ const sites = [
|
|||||||
parameters: {
|
parameters: {
|
||||||
// areaId: 3,
|
// areaId: 3,
|
||||||
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
areaId: '3b4c609c-6a0d-4cb9-9cce-0605f32b79ec',
|
||||||
blockId: 114458,
|
|
||||||
seriesId: 106,
|
seriesId: 106,
|
||||||
scene: 'https://aziani.com',
|
scene: 'https://aziani.com',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -71,10 +71,32 @@ function scrapeScene(data, channel, parameters) {
|
|||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getBlockId(slug, dataSource, entity, parameters) {
|
||||||
|
const res = await unprint.get(`https://azianistudios.com/tour_api.php/content/page?slug=${slug}&data_source=${JSON.stringify(dataSource)}`, {
|
||||||
|
headers: {
|
||||||
|
Referer: entity.url,
|
||||||
|
'x-nats-cms-area-id': parameters.areaId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.ok && res.data.success) {
|
||||||
|
// unsure how the blocks differ exactly, but type set_view is missing directors for some reason
|
||||||
|
return res.data.blocks?.find((block) => ['navigation', 'html'].includes(block.settings.type))?.cms_block_id || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchLatest(channel, page = 1, { parameters }) {
|
async function fetchLatest(channel, page = 1, { parameters }) {
|
||||||
|
const blockId = await getBlockId(parameters.videos || '/videos', { page }, channel, parameters);
|
||||||
|
|
||||||
|
if (!blockId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams({
|
const query = new URLSearchParams({
|
||||||
cms_area_id: parameters.areaId,
|
cms_area_id: parameters.areaId,
|
||||||
cms_block_id: parameters.blockId,
|
cms_block_id: blockId,
|
||||||
count: 100,
|
count: 100,
|
||||||
start: (page - 1) * 100,
|
start: (page - 1) * 100,
|
||||||
orderby: 'published_desc',
|
orderby: 'published_desc',
|
||||||
@@ -106,10 +128,20 @@ async function fetchLatest(channel, page = 1, { parameters }) {
|
|||||||
async function fetchScene(url, entity, _baseRelease, { parameters }) {
|
async function fetchScene(url, entity, _baseRelease, { parameters }) {
|
||||||
const entryId = new URL(url).pathname.match(/\/video\/(\w+)/)[1];
|
const entryId = new URL(url).pathname.match(/\/video\/(\w+)/)[1];
|
||||||
|
|
||||||
|
if (!entryId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const blockId = await getBlockId('/video/:id', entryId, entity, parameters);
|
||||||
|
|
||||||
|
if (!blockId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams({
|
const query = new URLSearchParams({
|
||||||
cms_set_ids: entryId,
|
cms_set_ids: entryId,
|
||||||
cms_area_id: parameters.areaId,
|
cms_area_id: parameters.areaId,
|
||||||
cms_block_id: parameters.blockId,
|
cms_block_id: blockId,
|
||||||
content: 1,
|
content: 1,
|
||||||
orderby: 'published_desc',
|
orderby: 'published_desc',
|
||||||
content_type: 'video',
|
content_type: 'video',
|
||||||
@@ -172,7 +204,7 @@ function scrapeProfile(data, entity, parameters) {
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchProfile({ url }, { entity, parameters }) {
|
async function fetchProfile({ name, url }, { entity, parameters }) {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
// no easy search option
|
// no easy search option
|
||||||
return null;
|
return null;
|
||||||
@@ -180,9 +212,19 @@ async function fetchProfile({ url }, { entity, parameters }) {
|
|||||||
|
|
||||||
const actorId = new URL(url).pathname.match(/model\/(\d+)/)[1];
|
const actorId = new URL(url).pathname.match(/model\/(\d+)/)[1];
|
||||||
|
|
||||||
|
if (!actorId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const blockId = await getBlockId('/model/:id', { models: name, id: actorId }, entity, parameters);
|
||||||
|
|
||||||
|
if (!blockId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams({
|
const query = new URLSearchParams({
|
||||||
cms_data_value_ids: actorId,
|
cms_data_value_ids: actorId,
|
||||||
cms_block_id: entity.parameters.modelBlockId || entity.parameters.blockId,
|
cms_block_id: blockId,
|
||||||
cms_data_type_id: 4,
|
cms_data_type_id: 4,
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user