ytdlp-interface icon indicating copy to clipboard operation
ytdlp-interface copied to clipboard

Update check still hits GitHub API rate limit (60/h) — feature request: PAT auth + ETag conditional requests

Open survivor998 opened this issue 4 months ago • 2 comments

Thanks for the great tool! Relates to #168 — the crash on rate-limit was fixed, but the underlying rate-limit itself can still trip up users, so I'd like to propose a root-cause fix.

The error

When clicking "Check for update" (or any time the updater runs), the check fails with:

Got an unexpected response when checking GitHub for a new version: {"message":"API rate limit exceeded for <IP>..."} The response is valid JSON, but is not formatted as an array.

Root cause

GitHub limits unauthenticated REST API requests to 60/hour per source IP. Looking at util::get_inet_res in util.cpp: the request is made via WinINET (INTERNET_OPEN_TYPE_PRECONFIG) with only a User-Agent header — no Authorization header, and no If-None-Match / If-Modified-Since handling for 304 Not Modified. Each check also hits multiple /releases endpoints, so the budget runs out fast.

This is especially painful behind a shared exit IP (carrier-grade NAT, corporate/uni network, VPN node): other people on the same IP draw from the same 60/h budget, so even light use hits the limit. Downloading the release itself via the github.com / objects.githubusercontent.com CDN is unaffected — only the API check is.

Proposal

Two complementary changes, both backward-compatible:

  1. Conditional requests (ETag). Cache the ETag/Last-Modified from each release response and send If-None-Match next time. A 304 Not Modified response does not count against the rate limit (docs). This alone makes the common "no new version yet" case essentially free.
  2. Optional PAT authentication. Let users paste a personal access token (public-repo read needs no scopes) in Settings → Updater, sent as Authorization: Bearer <token>. This raises the limit to 5,000/hour and fully solves it for shared-IP users.

Nice-to-haves

  • Local cache with a short TTL (re-check at most once/day) so repeated clicks don't re-hit the API.
  • Treat the {"message":"API rate limit exceeded..."} JSON (or HTTP 403/429) gracefully instead of the "valid JSON, but not an array" message — fall back to "unable to check right now."

Happy to help test a build. Thanks for maintaining this!

survivor998 avatar Aug 04 '26 01:08 survivor998

i encounter the same. See can fix in hthe next release this tool is very good

kwanchingho201089us-afk avatar Aug 09 '26 12:08 kwanchingho201089us-afk

Optional PAT authentication. Let users paste a personal access token (public-repo read needs no scopes) in Settings → Updater, sent as Authorization: Bearer . This raises the limit to 5,000/hour and fully solves it for shared-IP users.

The next version will have optional PAT authentication (I put it in Settings -> Interface though). I will consider your other suggestions for subsequent versions.

ErrorFlynn avatar Nov 11 '26 20:11 ErrorFlynn