fix(route): add JavBus alternative domain (#9310)
This commit is contained in:
@@ -397,6 +397,14 @@ BT 之家的域名会变更,本路由以 <https://www.btbtt20.com> 为默认
|
||||
|
||||
## JavBus
|
||||
|
||||
::: tip 提示
|
||||
|
||||
JavBus 有多个备用域名,本路由默认使用永久域名 <https://javbus.com> ,若该域名无法访问,可以通过在路由最后加上 `?domain=<域名>` 指定路由访问的域名。如指定备用域名为 <https://javsee.icu>,则在所有 JavBus 路由最后加上 `?domain=javsee.icu` 即可,此时路由为 [`/javbus/home?domain=javsee.icu`](https://rsshub.app/javbus/home?domain=javsee.icu)
|
||||
|
||||
值得注意的是 **欧陆风云** 的域名与主域名有所不同,其备用域名亦然,本路由默认使用域名 <https://javbus.red> ,若该域名无法访问,可以通过在路由最后加上 `?western_domain=<域名>` 指定路由访问的域名。如指定备用域名为 <https://javsee.one>,则在所有 JavBus **欧陆风云** 路由最后加上 `?western_domain=javsee.one` 即可,此时路由为 [`/javbus/western/home?western_domain=javsee.one`](https://rsshub.app/javbus/western/home?western_domain=javsee.one)
|
||||
|
||||
:::
|
||||
|
||||
### 首页
|
||||
|
||||
<Route author="MegrezZhu CoderTonyChan" example="/javbus/home" path="/javbus/home"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { gid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/genre/${gid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/genre/${gid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const { createHandler } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = createHandler('https://www.javbus.com/');
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await getPage(getDomain(ctx), ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { labelid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/label/${labelid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/label/${labelid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { seriesid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/series/${seriesid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/series/${seriesid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { sid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/star/${sid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/star/${sid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('./util');
|
||||
const { getPage, getDomain } = require('./util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { studioid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/studio/${studioid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/studio/${studioid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { gid } = ctx.params;
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/uncensored/genre/${gid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/uncensored/genre/${gid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const { createHandler } = require('../util');
|
||||
const { getPage, getDomain } = require('../util');
|
||||
|
||||
module.exports = createHandler('https://www.javbus.com/uncensored');
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/uncensored`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { seriesid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/uncensored/series/${seriesid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/uncensored/series/${seriesid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { sid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.com/uncensored/star/${sid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getDomain(ctx)}/uncensored/star/${sid}`, ctx);
|
||||
};
|
||||
|
||||
+36
-32
@@ -2,6 +2,10 @@ const got = require('@/utils/got');
|
||||
const { load } = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
exports.getDomain = (ctx) => `https://www.${ctx.query.domain ?? 'javbus.com'}`;
|
||||
|
||||
exports.getWesternDomain = (ctx) => `https://www.${ctx.query.western_domain ?? 'javbus.red'}`;
|
||||
|
||||
exports.getPage = async (url, ctx) => {
|
||||
const { data } = await got(url);
|
||||
const $ = load(data);
|
||||
@@ -16,10 +20,6 @@ exports.getPage = async (url, ctx) => {
|
||||
};
|
||||
};
|
||||
|
||||
exports.createHandler = (url) => async (ctx) => {
|
||||
ctx.state.data = await exports.getPage(url, ctx);
|
||||
};
|
||||
|
||||
const parseItems = ($, ctx) =>
|
||||
$('.movie-box')
|
||||
.map((_, ele) => ({
|
||||
@@ -144,36 +144,40 @@ const getDetail = async (link, ctx) =>
|
||||
screenData = null;
|
||||
}
|
||||
|
||||
const filmGid = /gid = ([0-9]*?);/.exec(detailPage);
|
||||
const filmUc = /uc = ([0-9]*?);/.exec(detailPage);
|
||||
const filmImg = /var img = '(.*?)';/.exec(detailPage);
|
||||
const filmFloor = Math.floor(Math.random() * 1000 + 1);
|
||||
const apiurl = `https://www.javbus.com/ajax/uncledatoolsbyajax.php?gid=${filmGid[1]}&lang=zh&img=${filmImg[1]}&uc=${filmUc[1]}&floor=${filmFloor}`;
|
||||
const apiresp = await got({
|
||||
method: 'get',
|
||||
url: apiurl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const magnettable = apiresp.data;
|
||||
match = magnettable.match(/<tr onmouseover=[\s\S]*?<\/tr>/gm);
|
||||
let magnetlinks = [];
|
||||
if (match) {
|
||||
magnetlinks = match.map((str) => {
|
||||
// magnet地址
|
||||
const mlink = /td width="70%" onclick="window.open\('(magnet.*?)',/.exec(str)[1];
|
||||
// console.log(str);
|
||||
// 提取a链接
|
||||
const mrow = str.match(/<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</gm);
|
||||
// magnet名称
|
||||
const mname = /<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</.exec(mrow[0])[1].trim();
|
||||
// magnet大小
|
||||
const msize = /<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</.exec(mrow[1])[1].trim();
|
||||
// return "<a href=\""+mlink+"\">"+mname+" -- "+msize+ "<\/a><textarea readonly rows=\"5\" cols=\"50\">"+ mlink + "<\/textarea><br \/>";
|
||||
return '<a href="' + mlink + '">' + mname + ' -- ' + msize + '</a><br />';
|
||||
try {
|
||||
const filmGid = /gid = ([0-9]*?);/.exec(detailPage);
|
||||
const filmUc = /uc = ([0-9]*?);/.exec(detailPage);
|
||||
const filmImg = /var img = '(.*?)';/.exec(detailPage);
|
||||
const filmFloor = Math.floor(Math.random() * 1000 + 1);
|
||||
const apiurl = `${exports.getDomain(ctx)}/ajax/uncledatoolsbyajax.php?gid=${filmGid[1]}&lang=zh&img=${filmImg[1]}&uc=${filmUc[1]}&floor=${filmFloor}`;
|
||||
const apiresp = await got({
|
||||
method: 'get',
|
||||
url: apiurl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const magnettable = apiresp.data;
|
||||
match = magnettable.match(/<tr onmouseover=[\s\S]*?<\/tr>/gm);
|
||||
if (match) {
|
||||
magnetlinks = match.map((str) => {
|
||||
// magnet地址
|
||||
const mlink = /td width="70%" onclick="window.open\('(magnet.*?)',/.exec(str)[1];
|
||||
// console.log(str);
|
||||
// 提取a链接
|
||||
const mrow = str.match(/<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</gm);
|
||||
// magnet名称
|
||||
const mname = /<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</.exec(mrow[0])[1].trim();
|
||||
// magnet大小
|
||||
const msize = /<a [\s\S]*?magnet[\s\S]*?">([\s\S]*?)</.exec(mrow[1])[1].trim();
|
||||
// return "<a href=\""+mlink+"\">"+mname+" -- "+msize+ "<\/a><textarea readonly rows=\"5\" cols=\"50\">"+ mlink + "<\/textarea><br \/>";
|
||||
return '<a href="' + mlink + '">' + mname + ' -- ' + msize + '</a><br />';
|
||||
});
|
||||
} else {
|
||||
magnetlinks = null;
|
||||
}
|
||||
} catch (e) {
|
||||
magnetlinks = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getWesternDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { gid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.one/genre/${gid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getWesternDomain(ctx)}/genre/${gid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const { createHandler } = require('../util');
|
||||
const { getPage, getWesternDomain } = require('../util');
|
||||
|
||||
module.exports = createHandler('https://www.javbus.one/');
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await getPage(getWesternDomain(ctx), ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getWesternDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { seriesid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.one/series/${seriesid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getWesternDomain(ctx)}/series/${seriesid}`, ctx);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { getPage } = require('../util');
|
||||
const { getPage, getWesternDomain } = require('../util');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { sid } = ctx.params;
|
||||
|
||||
ctx.state.data = await getPage(`https://www.javbus.one/star/${sid}`, ctx);
|
||||
ctx.state.data = await getPage(`${getWesternDomain(ctx)}/star/${sid}`, ctx);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user