fix: domp4 supports secondary address (#14181) (#14189)

* fix: domp4 supports secondary address

* fix: domp4 remove invalid domain
This commit is contained in:
savokiss
2024-01-05 21:53:13 +08:00
committed by GitHub
parent 48fea97555
commit c33deddf78
3 changed files with 9 additions and 5 deletions
+6 -4
View File
@@ -25,7 +25,7 @@ function getDomList($, detailUrl) {
return list;
}
function getItemList($, detailUrl) {
function getItemList($, detailUrl, second) {
const encoded = $('.article script[type]')
.text()
.match(/return p}\('(.*)',(\d+),(\d+),'(.*)'.split\(/);
@@ -39,7 +39,9 @@ function getItemList($, detailUrl) {
.replace(/\\\\"/g, '"')
.replace(/\\\\\\/g, '')
);
const { downurls } = data.Data[0];
// support secondary download address
const { downurls } = second && data.Data.length > 1 ? data.Data[1] : data.Data[0];
return downurls.map((item) => {
const [title, downurl] = item.split('$');
const urlType = getUrlType(downurl);
@@ -69,7 +71,7 @@ function getMetaInfo($) {
module.exports = async (ctx) => {
const { id } = ctx.params;
const { domain } = ctx.query;
const { domain, second } = ctx.query;
let pureId = id;
let detailType = 'html';
// compatible for .html suffix in radar
@@ -84,7 +86,7 @@ module.exports = async (ctx) => {
const res = await got(detailUrl);
const $ = cheerio.load(res.data);
const list = getItemList($, detailUrl);
const list = getItemList($, detailUrl, second);
const meta = getMetaInfo($);
ctx.state.data = {
+1 -1
View File
@@ -2,7 +2,7 @@ const config = require('@/config').value;
const defaultDomain = 'mp4us.com';
const allowedDomains = ['domp4.cc', 'mp4kan.com', 'mp4us.com', 'wemp4.com', 'dbmp4.com'];
const allowedDomains = ['domp4.cc', 'mp4us.com', 'wemp4.com', 'dbmp4.com'];
/**
* trackers from https://www.domp4.cc/Style/2020/js/base.js?v=2
+2
View File
@@ -403,6 +403,8 @@ Full transcript support for better user experience.
:::tip
由于大部分详情页是 `/html/xxx.html`,还有部分是 `/detail/123.html`,所以此处做了兼容,id 取 `xxx` 或者 `123` 都可以。
新增 `second` 参数,用于选择下载地址二(地址二不可用或者不填都默认地址一),用法: `/domp4/detail/LBTANI22222I?second=1`。
:::
## E-Hentai {#e-hentai}