A feature-rich command-line audio/video downloader
Merge branch 'download-archive'
Philipp Hagemeisterb24f347190b0
diff --cc youtube_dl/YoutubeDL.pyindex 9ada01bcc6,856e9ac929..073a3837c2--- a/youtube_dl/YoutubeDL.py+++ b/youtube_dl/YoutubeDL.py@@@ -84,8 -85,9 +85,11 @@@ 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.The following parameters are not used by YoutubeDL itself, they are used bythe FileDownloader:@@@ -311,10 -313,9 +315,13 @@@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)return Nonedef extract_info(self, url, download=True, ie_key=None, extra_info={}):diff --cc youtube_dl/__init__.pyindex 7a399273a0,a680d7c557..ba5206387a--- a/youtube_dl/__init__.py+++ b/youtube_dl/__init__.py@@@ -188,9 -188,9 +188,12 @@@ def parseOpts(overrideArguments=None)selection.add_option('--datebefore', metavar='DATE', dest='datebefore', help='download only videos uploaded before this date', default=None)selection.add_option('--dateafter', metavar='DATE', dest='dateafter', help='download only videos uploaded after this date', default=None)selection.add_option('--no-playlist', action='store_true', dest='noplaylist', help='download only the currently playing video', default=False)+ selection.add_option('--age-limit', metavar='YEARS', dest='age_limit',+ help='download only videos suitable for the given age',+ default=None, type=int)+ selection.add_option('--download-archive', metavar='FILE',+ dest='download_archive',+ help='Download only videos not present in the archive file. Record all downloaded videos in it.')authentication.add_option('-u', '--username',@@@ -634,7 -634,7 +637,8 @@@ def _real_main(argv=None)'daterange': date,'cachedir': opts.cachedir,'youtube_print_sig_code': opts.youtube_print_sig_code,+ 'age_limit': opts.age_limit,+ 'download_archive': opts.download_archive,})if opts.verbose: