pytubefix
pytubefix copied to clipboard
70dcBUFysyo has age restrictions and cannot be accessed without confirmation.
Describe the bug Hello, I found that a small number of videos prompt this error. Please help take a look.
To Reproduce Steps to reproduce the behavior:
- test codes
from pytubefix import YouTube
from pytubefix import Channel
def test_YouTube():
url = 'https://www.youtube.com/watch?v=70dcBUFysyo' # has age restrictions and cannot be accessed without confirmation.
yt = YouTube(url, on_progress_callback=show_download_progress, use_oauth=True, allow_oauth_cache=True)
video_stream = yt.streams.get_highest_resolution()
output_path = r"./"
video_title_file = "test1.mp4"
video_stream.download(output_path=output_path, filename=video_title_file, max_retries=5)
def show_download_progress(stream, chunk, bytes_remaining):
total_size = stream.filesize
bytes_downloaded = total_size - bytes_remaining
progress = (bytes_downloaded / total_size) * 100
print(f"{progress:.2f}% ({bytes_downloaded / 1024 / 1024:.2f} MB / {total_size / 1024 / 1024:.2f} MB)", end='\r')
if __name__ == '__main__':
test_YouTube()
- See error
Traceback (most recent call last):
File "D:\code\python\project\examples\pytube\test_pytubefix.py", line 74, in <module>
if __name__ == '__main__':
File "D:\code\python\project\examples\pytube\test_pytubefix.py", line 15, in test_YouTube
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\pytubefix\__main__.py", line 563, in streams
self.check_availability()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\pytubefix\__main__.py", line 321, in check_availability
self.age_check()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\pytubefix\__main__.py", line 417, in age_check
raise exceptions.AgeCheckRequiredError(self.video_id)
pytubefix.exceptions.AgeCheckRequiredError: 70dcBUFysyo has age restrictions and cannot be accessed without confirmation.
Desktop (please complete the following information):
- OS: [Windows 11]
- Python Version [3.10.11]
- Pytubefix Version [6.11.0]