JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
https://pytubefix.readthedocs.io
MIT License
751 stars 104 forks source link

Youtube sending fake audio and fake video duration by random #48

Closed NannoSilver closed 8 months ago

NannoSilver commented 8 months ago

I am running pytubefix 2.1.1.

Since 27/APR/2024 Youtube is sending by random fake information regarding the video duration and fake audio when the download is requested.

The fake video duration is reported by Youtube as 5:00 (5 minutes). And the fake audio (downloaded with itag = 140) has 5 minutes of silence.

The used code is similar to this:

yt_url = 'https://www.youtube.com/watch?v=klZsROHwW3s'
duration = YouTube(yt_url).length

yt = YouTube(yt_url)
stream = yt.streams.get_by_itag(140)
stream.download(filename='filename_of_audio.m4a')

Anybody else with this issue?

NannoSilver commented 8 months ago

One more information...

I tried the download with different IPs, and I am getting the fake audio by random. Seems Youtube is detecting the request is coming Pytubefix (?)

yinheng-gh commented 8 months ago

I encountered the same issue today, and the video title I got was "Video Not Available." I had to switch through several IP addresses before I could successfully download it.

yinheng-gh commented 8 months ago

I tried pytube and it works fine, but the caption feature of pytube has been problematic. So for now, I'm using pytube to download videos and audios, while using pytubefix to download captions.

JuanBindez commented 8 months ago

try pip install pytubefix==3.0rc1

felipeucelli commented 8 months ago

Working again, however some videos that are not labeled as music may generate exceptions.

Apparently YouTube has started randomly testing a new request requirement. In my tests it seems to be something related to 'params': 'CgIQBg', see here.

YouTube is returning an error video:

image

This has been reported several times, the latest solution was found here.

JuanBindez commented 8 months ago

I tested several types of videos, and so far no exceptions have been returned.

NannoSilver commented 8 months ago

try pip install pytubefix==3.0rc1

I am running version 3.0rc1 for a few hours and seems it works properly.

While downloading around 200 audio files, I got only one single Exception error. Likely related to something else.

Tomorrow I will install the 3.0.0 final release.

Thank you for the quick fix, @JuanBindez !