diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-10-06 16:23:18 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-10-06 16:23:18 +0200 |
commit | 2a69c6b87910d3dbeec14d3c6f7e16855944a0ad (patch) | |
tree | 80c395e99529f4b805d79978d82c6beaf37ff7bb /youtube_dl/YoutubeDL.py | |
parent | e484c81f0c0a6faf959037ac03b504e4794d72df (diff) | |
parent | cfadd183c4a281e97fba89501d59ee344bcc5978 (diff) |
Merge branch 'age_limit'
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r-- | youtube_dl/YoutubeDL.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 2503fd09b..9ada01bcc 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -84,6 +84,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. The following parameters are not used by YoutubeDL itself, they are used by the FileDownloader: @@ -309,6 +311,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' return None def extract_info(self, url, download=True, ie_key=None, extra_info={}): |