I'm trying to download this(http://youtube.com/watch?v=hnGWlry_H_Q) or this (https://www.youtube.com/watch?v=j4JQFz_8XxU) from YouTube but when I use yt.streams it just gives an empty list without any streams.
Thank you for contributing to PyTube. Please remember to reference Contributing.md
Oh that's really weird. I'll try to look into this soon to see what's causing that.
@tfdahlin I tried earlier and there was an error on this line https://github.com/nficano/pytube/blob/fab1c34c3b6059697ed0288493d987ecbb273ae9/pytube/extract.py#L425, maybe because the regex doesn't match. Hopefully it helps.
I have the same with this video: https://www.youtube.com/watch?v=-EFjkY84Hlo
hi, i'll try to look into this issue soon
It's possible that this is related to the discussion on https://github.com/nficano/pytube/pull/808 where sometimes the metadata was in different spots for different videos.
I'm trying to download this(
http://youtube.com/watch?v=hnGWlry_H_Q) or this (https://www.youtube.com/watch?v=j4JQFz_8XxU) from YouTube but when I use yt.streams it just gives an empty list without any streams.
Same Code @tfdahlin
On My Pc; Python 3.8.6

On Heroku; python-3.8.2

YouTube(url=url).streams.get_audio_only() returned None for some songs and not others.
i looked into it and noticed apply_descrambler from extract.py looks for "formats" and "adaptiveFormats" in the Youtube classes vid_info variable, and that for some songs the data downloaded via self.vid_info_raw = request.get(self.vid_info_url) in __main__.py dont contain "formats" or "adaptiveFormats"
I have the same with this video: https://www.youtube.com/watch?v=-EFjkY84Hlo
I ran a test on this video and It has the same issue. The data downloaded has no "formats" or "adaptiveFormats"
Ive been using these videos for testing
https://www.youtube.com/watch?v=L5KMO7lmLsA missing "formats" and "adaptiveFormats
https://www.youtube.com/watch?v=H7oOqMcDcbo has "formats" and "adaptiveFormats
I don't know if this is the root cause of the problem but I think its a good starting point
I fixed this issue by switching the user-agent in the requests.py file
I fixed this issue by switching the user-agent in the requests.py file
can you show the code ?
from
base_headers = {"User-Agent": "Mozilla/5.0", "accept-language": "en-US,en"}
to
agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
base_headers = {"User-Agent": agent, "accept-language": "en-US,en"}
in the _execute_request function in request.py
I found the issue -- this was missing a key that should've been there from the get go. Going to fix and merge this quickly.
Once the unit tests pass, I'll merge it to fix this problem
To install the fix:
python -m pip install git+https://github.com/nficano/pytube
If there are additional problems, please create a new issue.
python -m pip install git+https://github.com/nficano/pytube
Didn't solve the issue for me, my video is: https://youtu.be/IQ_-PVPtIlI
@peternaf I'm not having any problems with that URL. If you're still having problems, please create a new ticket with the full traceback
@peternaf I'm not having any problems with that URL. If you're still having problems, please create a new ticket with the full traceback
Re-run the install command and it seems to be downloading now. Thanks!
Same issue for me on this video.
Same issue for me on this video.
@ieshaan12 your video is working on my side. uninstall pytube and install it again and see if it resolves it
Most helpful comment
To install the fix:
python -m pip install git+https://github.com/nficano/pytubeIf there are additional problems, please create a new issue.