From 07825f1340bcb8ba5931dd9a5172aaa9d8b59c24 Mon Sep 17 00:00:00 2001 From: Ethan Shen <42264778+nczitzk@users.noreply.github.com> Date: Thu, 29 Jun 2023 00:48:28 +0800 Subject: [PATCH] fix(route): multiple videos in posts of shuiguopai (#12698) * fix(route): new domain for shuiguopai * fix(route): multiple videos in posts of shuiguopai * update index.js * fix: update new domain for shuiguopai --- lib/v2/shuiguopai/index.js | 18 +++++++++++------- lib/v2/shuiguopai/templates/description.art | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/v2/shuiguopai/index.js b/lib/v2/shuiguopai/index.js index 1b555c8e8..392eac868 100644 --- a/lib/v2/shuiguopai/index.js +++ b/lib/v2/shuiguopai/index.js @@ -6,11 +6,13 @@ const { art } = require('@/utils/render'); const path = require('path'); module.exports = async (ctx) => { - const rootUrl = 'http://shuiguopai.com'; + const rootUrl = 'https://sgp3.fun'; const apiRootUrl = 'https://api.cbbee0.com'; const listUrl = `${apiRootUrl}/v1_2/homePage`; const filmUrl = `${apiRootUrl}/v1_2/filmInfo`; + const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 50; + const response = await got({ method: 'post', url: listUrl, @@ -18,7 +20,7 @@ module.exports = async (ctx) => { device_id: '', hm: '008-api', last_page: 0, - length: 3, + length: limit, ltype: 1, page: 1, userToken: '', @@ -48,18 +50,20 @@ module.exports = async (ctx) => { url: filmUrl, json: { device_id: '', - film_id: detailResponse.data.match(/film_id:"(\d+)",/)[1], + film_id: detailResponse.data.match(/film_id:"([\d,]+)",/)[1], hm: '008-api', userToken: '', }, }); - const data = infoResponse.data.data[0]; + const data = infoResponse.data.data; - item.author = data.actor; - item.category = data.tags.map((t) => t.tag_title); + const videos = data.map((d) => d.download_url); + + item.category = data.flatMap((d) => d.tags.map((t) => t.tag_title)); + item.author = data.map((d) => d.actor).join(' '); item.description = art(path.join(__dirname, 'templates/description.art'), { - video: data.download_url, + videos, description: content('.content').html(), }); diff --git a/lib/v2/shuiguopai/templates/description.art b/lib/v2/shuiguopai/templates/description.art index 2609b35e3..8687d7eee 100644 --- a/lib/v2/shuiguopai/templates/description.art +++ b/lib/v2/shuiguopai/templates/description.art @@ -1,6 +1,8 @@ -{{ if video }} +{{ if videos }} +{{ each videos video }} +{{ /each }} {{ /if }} {{@ description }} \ No newline at end of file