X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2FYoutubeDL.py;fp=youtube_dl%2FYoutubeDL.py;h=073a3837c2c233535a2b5207f6ee4605952f6924;hb=b24f347190b02e519dae9e60e1dff2c56ecdd92f;hp=856e9ac929eb3512bedf6d0daf3f10f9558e25ad;hpb=ee6c9f95e1e5cf118b0bdf6abc8376bd95bc7dcf;p=youtube-dl diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 856e9ac92..073a3837c 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -85,6 +85,8 @@ class YoutubeDL(object): cachedir: Location of the cache files in the filesystem. None to disable filesystem cache. noplaylist: Download single video instead of a playlist if in doubt. + age_limit: An integer representing the user's age in years. + Unsuitable videos for the given age are skipped. downloadarchive: File name of a file where all downloads are recorded. Videos already present in the file are not downloaded again. @@ -313,6 +315,10 @@ class YoutubeDL(object): dateRange = self.params.get('daterange', DateRange()) if date not in dateRange: return u'[download] %s upload date is not in range %s' % (date_from_str(date).isoformat(), dateRange) + age_limit = self.params.get('age_limit') + if age_limit is not None: + if age_limit < info_dict.get('age_limit', 0): + return u'Skipping "' + title + '" because it is age restricted' if self.in_download_archive(info_dict): return (u'%(title)s has already been recorded in archive' % info_dict)