pythondatasetpytube

how to download videos that require age verification with pytube?


I download and clip some youtube videos with pytube but some videos are not downloading and asking for age verification. How can I solve this? Thanks for your advice


Solution

  • For pytube 15.0.0 I had the AgeRestrictedError in streams contents even using the use_oauth option.

    I fixed the problem only replacing ANDROID_MUSIC with ANDROID as "client" at line 223 of innertube.py:

    def __init__(self, client='ANDROID_MUSIC', use_oauth=False, allow_cache=True): 
    
    def __init__(self, client='ANDROID', use_oauth=False, allow_cache=True):