mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
fix(route): javdb alternative domain (#7536)
This commit is contained in:
@@ -297,7 +297,7 @@ pageClass: routes
|
|||||||
|
|
||||||
### 主页
|
### 主页
|
||||||
|
|
||||||
<Route author="nczitzk" example="/javdb/home" path="/javdb/home/:caty?/:sort?/:filter?" :paramsDesc="['分类,见下表,默认为 `有碼`', '排序,见下表,默认为 `磁鏈更新排序`', '过滤,见下表,默认为 `可下载`']">
|
<Route author="nczitzk" example="/javdb" path="/javdb/:category?/:sort?/:filter?" :paramsDesc="['分类,见下表,默认为 `有碼`', '排序,见下表,默认为 `磁鏈更新排序`', '过滤,见下表,默认为 `可下载`']">
|
||||||
|
|
||||||
分类
|
分类
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ pageClass: routes
|
|||||||
|
|
||||||
### 分類
|
### 分類
|
||||||
|
|
||||||
<Route author="nczitzk" example="/javdb/tags/c2=5&c10=1" path="/javdb/tags/:query?/:caty?" :paramsDesc="['筛选,默认为 `c10=1`', '分类,见下表,默认为 `有碼`']">
|
<Route author="nczitzk" example="/javdb/tags/c2=5&c10=1" path="/javdb/tags/:query?/:category?" :paramsDesc="['筛选,默认为 `c10=1`', '分类,见下表,默认为 `有碼`']">
|
||||||
|
|
||||||
::: tip 提示
|
::: tip 提示
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ pageClass: routes
|
|||||||
|
|
||||||
### 排行榜
|
### 排行榜
|
||||||
|
|
||||||
<Route author="nczitzk" example="/javdb/rankings" path="/javdb/rankings/:caty?/:time?" :paramsDesc="['分类,见下表,默认为 `有碼`', '时间,见下表,默认为 `日榜`']">
|
<Route author="nczitzk" example="/javdb/rankings" path="/javdb/rankings/:category?/:time?" :paramsDesc="['分类,见下表,默认为 `有碼`', '时间,见下表,默认为 `日榜`']">
|
||||||
|
|
||||||
分类
|
分类
|
||||||
|
|
||||||
|
|||||||
@@ -3477,13 +3477,14 @@ router.get('/mercari/:type/:id', lazyloadRouteHandler('./routes/mercari/index'))
|
|||||||
router.get('/notefolio/:caty?/:order?/:time?/:query?', lazyloadRouteHandler('./routes/notefolio/index'));
|
router.get('/notefolio/:caty?/:order?/:time?/:query?', lazyloadRouteHandler('./routes/notefolio/index'));
|
||||||
|
|
||||||
// JavDB
|
// JavDB
|
||||||
router.get('/javdb/home/:caty?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb/home'));
|
router.get('/javdb/home/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
|
||||||
router.get('/javdb/search/:keyword?/:filter?', lazyloadRouteHandler('./routes/javdb/search'));
|
router.get('/javdb/search/:keyword?/:filter?', lazyloadRouteHandler('./routes/javdb/search'));
|
||||||
router.get('/javdb/tags/:query?/:caty?', lazyloadRouteHandler('./routes/javdb/tags'));
|
router.get('/javdb/tags/:query?/:caty?', lazyloadRouteHandler('./routes/javdb/tags'));
|
||||||
router.get('/javdb/actors/:id/:filter?', lazyloadRouteHandler('./routes/javdb/actors'));
|
router.get('/javdb/actors/:id/:filter?', lazyloadRouteHandler('./routes/javdb/actors'));
|
||||||
router.get('/javdb/makers/:id/:filter?', lazyloadRouteHandler('./routes/javdb/makers'));
|
router.get('/javdb/makers/:id/:filter?', lazyloadRouteHandler('./routes/javdb/makers'));
|
||||||
router.get('/javdb/series/:id/:filter?', lazyloadRouteHandler('./routes/javdb/series'));
|
router.get('/javdb/series/:id/:filter?', lazyloadRouteHandler('./routes/javdb/series'));
|
||||||
router.get('/javdb/rankings/:caty?/:time?', lazyloadRouteHandler('./routes/javdb/rankings'));
|
router.get('/javdb/rankings/:caty?/:time?', lazyloadRouteHandler('./routes/javdb/rankings'));
|
||||||
|
router.get('/javdb/:category?/:sort?/:filter?', lazyloadRouteHandler('./routes/javdb'));
|
||||||
|
|
||||||
// World Economic Forum
|
// World Economic Forum
|
||||||
router.get('/weforum/report/:lang?/:year?/:platform?', lazyloadRouteHandler('./routes/weforum/report'));
|
router.get('/weforum/report/:lang?/:year?/:platform?', lazyloadRouteHandler('./routes/weforum/report'));
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.filter = ctx.params.filter || '';
|
const id = ctx.params.id;
|
||||||
|
const filter = ctx.params.filter || '';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/actors/${ctx.params.id}?t=${ctx.params.filter}`;
|
const currentUrl = `/actors/${id}?t=${filter}`;
|
||||||
|
|
||||||
const filter = {
|
const filters = {
|
||||||
'': '',
|
'': '',
|
||||||
p: '可播放',
|
p: '可播放',
|
||||||
s: '單體作品',
|
s: '單體作品',
|
||||||
@@ -13,7 +14,7 @@ module.exports = async (ctx) => {
|
|||||||
c: '含字幕',
|
c: '含字幕',
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = `JavDB${filter[ctx.params.filter] === '' ? '' : ` - ${filter[ctx.params.filter]}`} `;
|
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `;
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
const utils = require('./utils');
|
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
|
||||||
ctx.params.caty = ctx.params.caty || 'censored';
|
|
||||||
ctx.params.sort = ctx.params.sort || '2';
|
|
||||||
ctx.params.filter = ctx.params.filter || '1';
|
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/${ctx.params.caty === 'censored' ? '' : ctx.params.caty}?vft=${ctx.params.filter}&vst=${ctx.params.sort}`;
|
|
||||||
|
|
||||||
const category = {
|
|
||||||
censored: '有碼',
|
|
||||||
uncensored: '無碼',
|
|
||||||
western: '歐美',
|
|
||||||
fc2: 'FC2',
|
|
||||||
};
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
0: '',
|
|
||||||
1: '可下载',
|
|
||||||
2: '含字幕',
|
|
||||||
3: '含短評',
|
|
||||||
};
|
|
||||||
|
|
||||||
const sort = {
|
|
||||||
1: '发布日期排序',
|
|
||||||
2: '磁鏈更新排序',
|
|
||||||
};
|
|
||||||
|
|
||||||
const title = `${category[ctx.params.caty]} - JavDB - ${filter[ctx.params.filter] === '' ? '|' : `${filter[ctx.params.filter]} | `}${sort[ctx.params.sort]}`;
|
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
|
||||||
};
|
|
||||||
32
lib/routes/javdb/index.js
Normal file
32
lib/routes/javdb/index.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const category = ctx.params.caty || 'censored';
|
||||||
|
const sort = ctx.params.sort || '2';
|
||||||
|
const filter = ctx.params.filter || '1';
|
||||||
|
|
||||||
|
const currentUrl = `${category === 'censored' ? '' : category}?vft=${filter}&vst=${sort}`;
|
||||||
|
|
||||||
|
const categories = {
|
||||||
|
censored: '有碼',
|
||||||
|
uncensored: '無碼',
|
||||||
|
western: '歐美',
|
||||||
|
fc2: 'FC2',
|
||||||
|
};
|
||||||
|
|
||||||
|
const filters = {
|
||||||
|
0: '',
|
||||||
|
1: '可下载',
|
||||||
|
2: '含字幕',
|
||||||
|
3: '含短評',
|
||||||
|
};
|
||||||
|
|
||||||
|
const sorts = {
|
||||||
|
1: '发布日期排序',
|
||||||
|
2: '磁鏈更新排序',
|
||||||
|
};
|
||||||
|
|
||||||
|
const title = `${categories[category]} - JavDB - ${filters[filter] === '' ? '|' : `${filters[filter]} | `}${sorts[sort]}`;
|
||||||
|
|
||||||
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
|
};
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.filter = ctx.params.filter || '';
|
const id = ctx.params.id;
|
||||||
|
const filter = ctx.params.filter || '';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/makers/${ctx.params.id}?f=${ctx.params.filter}`;
|
const currentUrl = `/makers/${id}?f=${filter}`;
|
||||||
|
|
||||||
const filter = {
|
const filters = {
|
||||||
'': '',
|
'': '',
|
||||||
playable: '可播放',
|
playable: '可播放',
|
||||||
single: '單體作品',
|
single: '單體作品',
|
||||||
@@ -14,7 +15,7 @@ module.exports = async (ctx) => {
|
|||||||
preview: '預覽圖',
|
preview: '預覽圖',
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = `JavDB${filter[ctx.params.filter] === '' ? '' : ` - ${filter[ctx.params.filter]}`} `;
|
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `;
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.caty = ctx.params.caty || 'censored';
|
const category = ctx.params.category || 'censored';
|
||||||
ctx.params.time = ctx.params.time || 'daily';
|
const time = ctx.params.time || 'daily';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/rankings/video_${ctx.params.caty}?period=${ctx.params.time}`;
|
const currentUrl = `/rankings/video_${category}?period=${time}`;
|
||||||
|
|
||||||
const title = 'JavDB';
|
const title = 'JavDB';
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.filter = ctx.params.filter || '';
|
const filter = ctx.params.filter || '';
|
||||||
ctx.params.keyword = ctx.params.keyword || '';
|
const keyword = ctx.params.keyword || '';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/search?q=${ctx.params.keyword}&f=${ctx.params.filter}`;
|
const currentUrl = `/search?q=${keyword}&f=${filter}`;
|
||||||
|
|
||||||
const filter = {
|
const filters = {
|
||||||
'': '',
|
'': '',
|
||||||
playable: '可播放',
|
playable: '可播放',
|
||||||
single: '單體作品',
|
single: '單體作品',
|
||||||
@@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
|||||||
preview: '預覽圖',
|
preview: '預覽圖',
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = `關鍵字 ${ctx.params.keyword} ${filter[ctx.params.filter] === '' ? '' : `+ ${filter[ctx.params.filter]}`} 搜索結果 - JavDB `;
|
const title = `關鍵字 ${keyword} ${filters[filter] === '' ? '' : `+ ${filters[filter]}`} 搜索結果 - JavDB`;
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.filter = ctx.params.filter || '';
|
const id = ctx.params.id;
|
||||||
|
const filter = ctx.params.filter || '';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/series/${ctx.params.id}?f=${ctx.params.filter}`;
|
const currentUrl = `/series/${id}?f=${filter}`;
|
||||||
|
|
||||||
const filter = {
|
const filters = {
|
||||||
'': '',
|
'': '',
|
||||||
playable: '可播放',
|
playable: '可播放',
|
||||||
single: '單體作品',
|
single: '單體作品',
|
||||||
@@ -14,7 +15,7 @@ module.exports = async (ctx) => {
|
|||||||
preview: '預覽圖',
|
preview: '預覽圖',
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = `JavDB${filter[ctx.params.filter] === '' ? '' : ` - ${filter[ctx.params.filter]}`} `;
|
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filter[filter]}`} `;
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
ctx.params.caty = ctx.params.caty || 'censored';
|
const category = ctx.params.category || 'censored';
|
||||||
ctx.params.query = ctx.params.query || '';
|
const query = ctx.params.query || '';
|
||||||
|
|
||||||
const currentUrl = `${utils.rootUrl}/tags${ctx.params.caty === 'censored' ? '' : `/${ctx.params.caty}`}?${ctx.params.query}`;
|
const currentUrl = `/tags${category === 'censored' ? '' : `/${category}`}?${query}`;
|
||||||
|
|
||||||
const title = `JavDB${ctx.params.query === '' ? '' : ` - ${ctx.params.query}`} `;
|
const title = `JavDB${query === '' ? '' : ` - ${query}`} `;
|
||||||
|
|
||||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,28 +1,39 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
const rootUrl = 'https://javdb.com';
|
let rootUrl = 'https://javdb.com';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
rootUrl,
|
|
||||||
ProcessItems: async (ctx, currentUrl, title) => {
|
ProcessItems: async (ctx, currentUrl, title) => {
|
||||||
const response = await got({
|
let data;
|
||||||
method: 'get',
|
|
||||||
url: currentUrl,
|
|
||||||
});
|
|
||||||
|
|
||||||
const $ = cheerio.load(response.data);
|
try {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `${rootUrl}${currentUrl}`,
|
||||||
|
});
|
||||||
|
data = response.data;
|
||||||
|
} catch (err) {
|
||||||
|
rootUrl = rootUrl.replace('javdb', 'javdb7');
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `${rootUrl}${currentUrl}`,
|
||||||
|
});
|
||||||
|
data = response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
|
||||||
$('.tags').remove();
|
$('.tags').remove();
|
||||||
|
|
||||||
const list = $('.grid-item a')
|
const list = $('.grid-item a')
|
||||||
.slice(0, 5)
|
.slice(0, 15)
|
||||||
.map((_, item) => {
|
.map((_, item) => {
|
||||||
item = $(item);
|
item = $(item);
|
||||||
return {
|
return {
|
||||||
title: item.text(),
|
title: item.text(),
|
||||||
link: `${rootUrl}${item.attr('href')}`,
|
link: `${rootUrl}${item.attr('href')}`,
|
||||||
pubDate: new Date(item.find('.meta').text()).toUTCString(),
|
pubDate: Date.parse(item.find('.meta').text()),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
@@ -32,7 +43,7 @@ module.exports = {
|
|||||||
ctx.cache.tryGet(item.link, async () => {
|
ctx.cache.tryGet(item.link, async () => {
|
||||||
const detailResponse = await got({
|
const detailResponse = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: item.link,
|
F: item.link,
|
||||||
});
|
});
|
||||||
const content = cheerio.load(detailResponse.data);
|
const content = cheerio.load(detailResponse.data);
|
||||||
|
|
||||||
@@ -64,7 +75,7 @@ module.exports = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
title: subject === '' ? title : `${subject} - ${title}`,
|
title: subject === '' ? title : `${subject} - ${title}`,
|
||||||
link: currentUrl,
|
link: `${rootUrl}${currentUrl}`,
|
||||||
item: items,
|
item: items,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user