Files
RSSHub/lib/routes/javdb/makers.ts
T
a51cc049bf feat: add javdb session config and cookieJar to fakeGot (#14782)
* feat: add javdb session config

* fix: Return data instead of setting ctx.set in JavDB routes

* docs: Add JavDB login instructions to config.md

* docs: Add note about javdb session validity in config.md

* fix: Return data instead of setting ctx.set in JavDB routes

* fix: Update route path in javdb index.ts

Remove '/:category?/:sort?/:filter?', it will cause other module routes to be inaccessible

* chore: Remove unused cookie variable in ProcessItems function

* chore: Unnecessary changes

* chore: Add JAVDB sessions in alphabetical order.

* docs: Add JAVDB sessions in alphabetical order.

* feat: Add support for passing cookies in headers

* test: Add cookieJar test to got.test.ts

* Update lib/utils/got.ts

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* feat: Update JavDB routes to include optional JAVDB_SESSION in requireConfig

---------

Co-authored-by: zhaoyi.wu <zhaoyi.wu@amh-group.com>
2024-04-12 19:30:42 +08:00

59 lines
1.7 KiB
TypeScript

import { Route } from '@/types';
import utils from './utils';
export const route: Route = {
path: '/makers/:id/:filter?',
categories: ['multimedia'],
example: '/javdb/makers/7R',
parameters: { id: '编号,可在片商页 URL 中找到', filter: '过滤,见下表,默认为 `全部`' },
features: {
requireConfig: [
{
name: 'JAVDB_SESSION',
description: 'JavDB登陆后的session值,可在控制台的cookie下查找 `_jdb_session` 的值,即可获取',
optional: true,
},
],
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['javdb.com/'],
target: '',
},
],
name: '片商',
maintainers: ['nczitzk'],
handler,
url: 'javdb.com/',
description: `| 全部 | 可播放 | 單體作品 | 可下載 | 字幕 | 預覽圖 |
| ---- | -------- | -------- | -------- | ----- | ------- |
| | playable | single | download | cnsub | preview |
所有片商编号参见 [片商庫](https://javdb.com/makers)`,
};
async function handler(ctx) {
const id = ctx.req.param('id');
const filter = ctx.req.param('filter') ?? '';
const currentUrl = `/makers/${id}${filter ? `?f=${filter}` : ''}`;
const filters = {
'': '',
playable: '可播放',
single: '單體作品',
download: '可下載',
cnsub: '字幕',
preview: '預覽圖',
};
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `;
return await utils.ProcessItems(ctx, currentUrl, title);
}