Skip to content

fix(route/reuters): Adjust header#22086

Open
dzx-dzx wants to merge 5 commits into
DIYgod:masterfrom
dzx-dzx:reuters-headers
Open

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

Conversation

@dzx-dzx

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

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
@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

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Auto Review

  • [Rule 24 - Import Sorting] lib/routes/reuters/common.tsximport { PRESETS } from "@/utils/header-generator"; is added after import { parseDate } from "@/utils/parse-date";, but @/utils/header-generator sorts before @/utils/ofetch and @/utils/parse-date. Move it between import cache from "@/utils/cache"; and import ofetch from "@/utils/ofetch";.
  • Dead code referencing removed variable lib/routes/reuters/common.tsx — The PR adds an else block that returns, making the original section fetch code unreachable. However, this dead code still references the removed browserHeaders variable (headers: browserHeaders). Remove the unreachable code block after the else { ... } closing brace.

@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
@github-actions github-actions Bot removed the auto: not ready to review Users can't get the RSS feed output according to automated testing results label Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

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
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: 68789326

@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 Jun 6, 2026
@dzx-dzx dzx-dzx marked this pull request as ready for review June 16, 2026 09:53
@github-actions github-actions Bot removed the auto: not ready to review Users can't get the RSS feed output according to automated testing results label Jun 16, 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/>ReferenceError: browserHeaders is not defined
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: ffdc68c1

@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 Jun 16, 2026
rootUrl,
response,
};
} else {
@github-actions github-actions Bot removed the auto: not ready to review Users can't get the RSS feed output according to automated testing results label Jun 17, 2026
@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 Jun 17, 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
Route: /reuters/:category/:topic?
Full Route: /reuters/world/china
Node Version: v24.16.0
Git Hash: be46cb6b

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