From d51b0601258220e3114b76f09e826c6e2acf2f96 Mon Sep 17 00:00:00 2001 From: "Jagger.H" Date: Sat, 11 Jul 2026 05:08:41 +0800 Subject: [PATCH] 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. --- lib/routes/comicat/search.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/routes/comicat/search.ts b/lib/routes/comicat/search.ts index 6051a59164..3c013955a6 100644 --- a/lib/routes/comicat/search.ts +++ b/lib/routes/comicat/search.ts @@ -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]);