fix(route/comicat): pass visitor_test cookie to clear the anti-bot interstitial (#22656)

comicat.org now fronts every page with a fake JS "captcha" (/public/html/start/)
that redirects back only after setting a `visitor_test=human` cookie. A bare request
302s to that page, so #listTable and the detail selectors match nothing (empty feed).
Send the cookie directly on both the search listing and the per-item detail fetches.
This commit is contained in:
Jagger.H
2026-07-11 05:08:41 +08:00
committed by GitHub
parent 478df5e488
commit d51b060125
+8 -2
View File
@@ -7,6 +7,12 @@ import { parseDate } from '@/utils/parse-date';
const baseUrl = 'https://comicat.org';
// comicat.org fronts every page with a fake JS "captcha" interstitial (/public/html/start/)
// whose only effect is to POST a form that sets a `visitor_test=human` cookie. Sending that
// cookie directly skips the interstitial; without it every request 302s to the captcha page
// and the listing/detail selectors match nothing.
const headers = { Cookie: 'visitor_test=human' };
export const route: Route = {
path: '/search/:keyword',
categories: ['anime'],
@@ -27,7 +33,7 @@ export const route: Route = {
async function handler(ctx) {
const keyword = ctx.req.param('keyword');
const { data: response } = await got(`${baseUrl}/search.php?keyword=${encodeURIComponent(keyword)}`);
const { data: response } = await got(`${baseUrl}/search.php?keyword=${encodeURIComponent(keyword)}`, { headers });
const $ = load(response);
const list = $('#listTable tbody > tr')
.toArray()
@@ -41,7 +47,7 @@ async function handler(ctx) {
const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const { data: response } = await got(item.link, { headers });
const $ = load(response);
item.pubDate = parseDate($('div.main > div.slayout > div > div.c1 > div:nth-child(1) > div > p:nth-child(4)').text().split('发布时间: ', 2)[1]);