JuanBindez/pytubefix

Age restricted error being thrown when trying to access the streams of videos that aren't age restricted

Closed this issue ยท 10 comments

Description
Trying to access certain videos through Pytubefix 3.0.0 throws an age restricted error, despite the video not actually being age restricted. This might be due to the user agent, which has been changed to "ANDROID_MUSIC" in the latest version of innertube.py. I fixed this temporarily by setting the InnerTube user agent to "IOS", but I'm not sure how the functionality of the library itself is impacted by this change as I'm only using it for audio downloads (mostly through itag 140).

To Reproduce
Steps to reproduce the behavior:
Try to access the streams on one of the following videos:
https://www.youtube.com/watch?v=jDwVkXVHIqg&t=25s
https://www.youtube.com/watch?v=CP9tRsE5uaQ&t=276s

Expected behavior
We should be able to access any of the videos above without authentication as they aren't age restricted in any way.

Desktop (please complete the following information):

  • OS: Debian 12
  • Python Version 3.11
  • Pytubefix Version 3.0.0

Some my audios also not downloading.

Silent Video Not Available.mp3 file is downloaded when:
stream = ytsong.streams.get_audio_only()
stream.download(mp3=True)

Some my audios also not downloading.

Silent Video Not Available.mp3 file is downloaded when: stream = ytsong.streams.get_audio_only() stream.download(mp3=True)

For when Youtube send a fake audio that is silent, to fix you have to upgrade pytubefix to version 3.0.0 final release.

I am also facing problems to download some audio files (itag = 140) with pytubefix 3.0.0 final release.
It is raising the Exception of "Unavailable video". I am investigating and will post more details later.

I did an investigation on the Exception of "Unavailable video" I was getting as mention in my previous comment
In this particular case it is not an error, but the channel owner did set some geographical restriction for the video, that is available only for viewers of a particular country, and pytubefix 3.0.0 reports as "unavailable" when the download is requested.

I did an investigation on the Exception of "Unavailable video" I was getting as mention in my previous comment In this particular case it is not an error, but the channel owner did set some geographical restriction for the video, that is available only for viewers of a particular country, and pytubefix 3.0.0 reports as "unavailable" when the download is requested.

My update:

  • Link https://youtube.com/watch?v=-lPN2sh6C5E
  • I upgraded the package to latest, and I also download by itag 140 now.
  • Download is done successfully, but still there is no sound.
  • Running script locally on a Mac (country Kazakhstan)
  • Video with sound available in browser (Chrome Incognito mode)
  • I tried to download video itag==18 (not sound), the picture on video says that it's not available on my appliaction
image

Description Trying to access certain videos through Pytubefix 3.0.0 throws an age restricted error, despite the video not actually being age restricted. This might be due to the user agent, which has been changed to "ANDROID_MUSIC" in the latest version of innertube.py. I fixed this temporarily by setting the InnerTube user agent to "IOS", but I'm not sure how the functionality of the library itself is impacted by this change as I'm only using it for audio downloads (mostly through itag 140).

To Reproduce Steps to reproduce the behavior: Try to access the streams on one of the following videos: https://www.youtube.com/watch?v=jDwVkXVHIqg&t=25s https://www.youtube.com/watch?v=CP9tRsE5uaQ&t=276s

Expected behavior We should be able to access any of the videos above without authentication as they aren't age restricted in any way.

Desktop (please complete the following information):

* OS: Debian 12

* Python Version 3.11

* Pytubefix Version 3.0.0

I tested the two videos you mention and got the same "age restricted" issue.
Tested on Windows with python 3.9 and pytubefix 3.0.0.

I just tested your video link.
I could download the audio with itag 140 without any issue on Windows, python 3.9 and pytubefix 3.0.0.
At my ending the file has the correct sound it is expected to have (not silent).

Started working now on my remote VPS.

Locally and via VPN - it doesn't. So probably some issues related to location/ip from Youtube.

update to latest version -> pytubefix==4.0.0

The videos I mentioned in the original post are now downloading correctly as of 4.0.0. Moving back to using the Android client as default seems to have solved the issue.

The videos I mentioned in the original post are now downloading correctly as of 4.0.0. Moving back to using the Android client as default seems to have solved the issue.

I put it in ANDROID_MUSIC temporarily just so the library wouldn't be stuck 100%, it's not true the problem is in the parameter passed by the ANDROID client, which was causing nothing to work, every time this happens we will have to wait to find the parameter to be passed .