youtube-transcript-api icon indicating copy to clipboard operation
youtube-transcript-api copied to clipboard

Error checks on network calls, try/catch, etc

Open Joshfindit opened this issue 6 months ago • 0 comments

Related to #429 but happened to me in a few other situations (accessing from a VPS without a proxy)

I think it would be helpful to add checks and catches to any network calls:

  • Bad response code
  • Empty reply (this was the case for "no element found")
  • Response contents start with <!DOCTYPE html> when the expected reply is JSON (this is likely in the case of a text/HTML warning from YT when they make assumptions that it's someone writing a script)
  • Parsing response body fails due to invalid structure

If it's welcome, can I create a long-running feature branch for network error handling? I'll wrap the calls one at a time, keep it synced with main, and you can merge my progress incrementally.

Joshfindit avatar Jun 11 '25 23:06 Joshfindit