Skip to content

fix(route/youtube): surface quota errors instead of returning undefined - #23133

Merged
DIYgod merged 1 commit into
DIYgod:masterfrom
ryanchou1994:fix/youtube-surface-quota-errors
Sep 26, 2026
Merged

DIYgod merged 1 commit into
DIYgod:masterfrom
ryanchou1994:fix/youtube-surface-quota-errors

Conversation

@ryanchou1994

@ryanchou1994 ryanchou1994 commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Involved Issue / 该 PR 相关 Issue

Ref #22971

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

/youtube/live/@GawrGura

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

Not a new route; fixes the shared YouTube error path.

Note / 说明

Second ask in #22971: show quotaExceeded instead of a TypeError once the quota is gone.

The exec helper in the Google API wrapper rotates through the keys and swallows every failure, so with all keys exhausted it returns undefined and the route dies reading .data off that with Cannot read properties of undefined, which says nothing about quota.

Now, when every key failed and the last error carries a Google quota reason (quotaExceeded, dailyLimitExceeded, rateLimitExceeded, userRateLimitExceeded), it is rethrown so the error page shows the real 403 message. Key rotation is untouched, and other failures still return undefined on purpose — getDataByUsername reads that as "no content".

Old vs. new exec against the gaxios error shape:

keys before after
all quotaExceeded TypeError 403 quota message
all playlistNotFound TypeError unchanged
first quota, second OK data data
no keys TypeError unchanged

Cache interval is left alone: #21853 set it deliberately. The route test will show ConfigNotFoundError since CI has no YOUTUBE_KEY.

Replaces #23132 (auto-closed for description length); same change.

Copilot AI lite review requested due to automatic review settings August 29, 2026 13:52

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added route auto: not ready to review Users can't get the RSS feed output according to automated testing results labels Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/youtube/live/@GawrGura - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>ConfigNotFoundError: YouTube RSS is disabled due to the lack of &lt;a href=&quot;https://docs.rsshub.app/deploy/config#route-specific-configurations&quot;&gt;relevant config&lt;/a&gt;
Route: /youtube/live/:username/:embed?
Full Route: /youtube/live/@GawrGura
Node Version: v24.20.0
Git Hash: ed5dd7b5

@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 Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/youtube/live/@GawrGura - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>ConfigNotFoundError: YouTube RSS is disabled due to the lack of &lt;a href=&quot;https://docs.rsshub.app/deploy/config#route-specific-configurations&quot;&gt;relevant config&lt;/a&gt;
Route: /youtube/live/:username/:embed?
Full Route: /youtube/live/@GawrGura
Node Version: v24.20.0
Git Hash: ef9bbfae

@ryanchou1994

Copy link
Copy Markdown
Contributor Author

Route test above fails with ConfigNotFoundError: YouTube RSS is disabled due to the lack of relevant config — CI has no YOUTUBE_KEY, so every /youtube/* route reports Failed regardless of the diff. Same situation as #23131.

The change is only in the key-rotation helper's error path; the old/new comparison table in the description is how I verified it.

@ryanchou1994

Copy link
Copy Markdown
Contributor Author

Gentle ping — open for two weeks now. The only red check is the route test, which needs a YOUTUBE_KEY the CI doesn't have; the change itself only turns an exhausted-quota response into a readable error instead of the current TypeError on undefined. Happy to rebase or adjust anything if you'd rather take a different approach.

@DIYgod
DIYgod merged commit a5ef48a into DIYgod:master Sep 26, 2026
68 of 71 checks passed
@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 Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/youtube/live/@GawrGura - Failed ❌
HTTPError: Response code 503 (Service Unavailable)

Error Message:<br/>ConfigNotFoundError: YouTube RSS is disabled due to the lack of &lt;a href=&quot;https://docs.rsshub.app/deploy/config#route-specific-configurations&quot;&gt;relevant config&lt;/a&gt;
Route: /youtube/live/:username/:embed?
Full Route: /youtube/live/@GawrGura
Node Version: v24.21.0
Git Hash: 5a72028e

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