Skip to content

fix(route/reuters): Adjust header#22086

Draft
dzx-dzx wants to merge 3 commits into
DIYgod:masterfrom
dzx-dzx:reuters-headers
Draft

fix(route/reuters): Adjust header#22086
dzx-dzx wants to merge 3 commits into
DIYgod:masterfrom
dzx-dzx:reuters-headers

Conversation

@dzx-dzx
Copy link
Copy Markdown
Contributor

@dzx-dzx dzx-dzx commented May 23, 2026

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

/reuters/world/china

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

Copilot AI review requested due to automatic review settings May 23, 2026 13:52
@github-actions github-actions Bot added the route label May 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Reuters route fetching to use the shared header generator presets (Modern Windows) instead of manually passing a static browser-like header set.

Changes:

  • Import PRESETS from the header generator utility.
  • Switch ofetch calls from headers: browserHeaders to headerGeneratorOptions: PRESETS.MODERN_WINDOWS.
  • Add a hardcoded User-Agent to the local browserHeaders object.
Comments suppressed due to low confidence (2)

lib/routes/reuters/common.tsx:1

  • Switching from headers: browserHeaders to only headerGeneratorOptions risks dropping required request headers (e.g., Accept, Accept-Language, Referer) that Reuters may rely on for correct responses. If ofetch supports both, pass headers alongside headerGeneratorOptions, or generate headers and merge in the required overrides (especially Accept and Referer) before making the request.
import { load } from 'cheerio';

lib/routes/reuters/common.tsx:1

  • Same issue as the content request: this section request previously sent explicit browserHeaders, but now relies solely on the header generator preset. To avoid regressions (unexpected content negotiation, geo/language differences, or blocked responses), ensure the critical headers previously set are still applied (e.g., by merging browserHeaders as overrides on top of generated headers).
import { load } from 'cheerio';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/routes/reuters/common.tsx Outdated
Comment on lines 199 to 203
Accept: 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.9',
Referer: 'https://www.reuters.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0',
};
@github-actions github-actions Bot added the auto: not ready to review Users can't get the RSS feed output according to automated testing results label May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/reuters/world/china - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.reuters.com/arc/outboundfeeds/v4/mobile/section/world/china/?outputType=json&quot;: 404 Not Found
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: 8ac094f2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

Auto Review

  • [Rule 24 - Import Sorting] lib/routes/reuters/common.tsx — The new import { PRESETS } from '@/utils/header-generator'; is placed after import { parseDate } from '@/utils/parse-date';, but alphabetically it should come before import ofetch from '@/utils/ofetch';. Move it between import cache from '@/utils/cache'; and import ofetch from '@/utils/ofetch';.

@dzx-dzx dzx-dzx changed the title Master fix(route/reuters): Adjust header May 23, 2026
@github-actions github-actions Bot added auto: not ready to review Users can't get the RSS feed output according to automated testing results and removed auto: not ready to review Users can't get the RSS feed output according to automated testing results labels May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/reuters/world/china - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.reuters.com/arc/outboundfeeds/v4/mobile/section/world/china/?outputType=json&quot;: 404 Not Found
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: 8ac094f2

Comment thread lib/routes/reuters/common.tsx Fixed
@github-actions github-actions Bot added auto: not ready to review Users can't get the RSS feed output according to automated testing results and removed auto: not ready to review Users can't get the RSS feed output according to automated testing results labels May 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/reuters/world/china - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>FetchError: [GET] &quot;https://www.reuters.com/arc/outboundfeeds/v4/mobile/section/world/china/?outputType=json&quot;: 404 Not Found
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: a9e005e5

@dzx-dzx dzx-dzx marked this pull request as draft May 25, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto: not ready to review Users can't get the RSS feed output according to automated testing results route

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants