Closed amrutadotorg closed 2 months ago
Does this still work? I am not well versed in ytdlp plugins so I hope I just messed up trying to use it.
Would providing our own API credentials be a good idea or is it better off as is?
Does this still work? I am not well versed in ytdlp plugins so I hope I just messed up trying to use it.
Would providing our own API credentials be a good idea or is it better off as is?
Your own API creds won't work iirc, it requires the Youtube TV client.
From a quick look I don't think this PR works - it doesn't look like the code is hooked up to anything. The creds do not come from the player js either..
It kind of looks like this was written by AI..?
That said, I don't think we really need to bother extracting the client creds, since they rarely change (if at all)
ok, no problem
This modification introduces a new method _extract_oauth_credentials() which dynamically extracts the client ID, client secret, and scopes from the YouTube TV web page and its associated JavaScript file. Here's a breakdown of the changes:
We've added instance variables self._CLIENT_ID, self._CLIENT_SECRET, and self._SCOPES to store the extracted values. The _extract_oauth_credentials() method:
Downloads the YouTube TV web page Extracts the URL of the base.js file Downloads the base.js file Uses regular expressions to extract the CLIENT_ID, CLIENT_SECRET, and SCOPES from the JavaScript content
We call self._extract_oauth_credentials() at the beginning of both initialize_oauth() and authorize() methods to ensure we have the latest credentials before proceeding. If the extraction fails for any reason, we fall back to the original hardcoded values (represented by _SCOPES in this case).
This approach makes the code more maintainable and adaptable to changes in YouTube's authentication system. However, please note that this method relies on the current structure of YouTube's web pages and JavaScript files. If YouTube significantly changes their frontend, you might need to update the extraction logic.