Closed mytja closed 2 years ago
Hmmmm. After investigating I noticed this:
As for sync version and async version. It doesn't work for sync aswell as with async version. I will see what I can do.
Now, I found out, that ANDROID_EMBED client has same response as ANDROID client. Thus we can use ANDROID client, and now it should work for your example.
Please install latest version from streamurlfetcher
branch
pip install git+https://github.com/alexmercerind/youtube-search-python@streamurlfetcher
Thanks for quick response. I wouldn't catch this without you.
@mytja Looks like the latest fix takes care of the problem and I've tested multiple URLs to verify. Great work!
P.S. Just need to remove the JSON console debugging 😉
@mytja Looks like the latest fix takes care of the problem and I've tested multiple URLs to verify. Great work!
P.S. Just need to remove the JSON console debugging wink
Oh, thanks. Completly forgot about logging...
I'm getting an error.
>>> from youtubesearchpython import *
>>> fetcher = StreamURLFetcher()
>>> video = Video.get("https://www.youtube.com/watch?v=TxBXaMQP2Kg")
>>> url = fetcher.get(video, 251)
Traceback (most recent call last):
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\core\streamurlfetcher.py", line 85, in _decipher
stream = apply_descrambler(self._player_response["streamingData"])
TypeError: apply_descrambler() missing 1 required positional argument: 'key'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\streamurlfetcher.py", line 52, in get
self._getDecipheredURLs(videoFormats)
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\core\streamurlfetcher.py", line 51, in _getDecipheredURLs
self._decipher()
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\core\streamurlfetcher.py", line 96, in _decipher
self._decipher(retry = True)
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\core\streamurlfetcher.py", line 92, in _decipher
raise e
File "C:\Users\raitonoberu\AppData\Local\Programs\Python\Python38\lib\site-packages\youtubesearchpython\core\streamurlfetcher.py", line 85, in _decipher
stream = apply_descrambler(self._player_response["streamingData"])
TypeError: apply_descrambler() missing 1 required positional argument: 'key'
You probably have old version of PyTube installed. Can you try to install latest one?
I don't have much to say here.
PyTube doesn't like our JavaScript anymore for some reason, so we have to fetch it internally using PyTube. Also
uploadDate
andpublishDate
aren't available anymore in JSON YouTube sends us in Video class. This is a problem, which I don't know at the moment how to resolve...I'd like to hear what you think about this PR, so I'm adding you two as reviewers.
PS: One commit is already on main branch.... :sweat_smile: So make sure to look at this one too.