aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-04-27 14:01:55 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-04-27 14:01:55 +0200
commitbd55852517a40d011b303559f4cd78773a2f3de5 (patch)
tree9531a89c70f57cf06c23f39725e084858acb9c81 /youtube_dl/FileDownloader.py
parent4c9f7a9988f296eeedd0843cded5cbcec3392adb (diff)
downloadyoutube-dl-bd55852517a40d011b303559f4cd78773a2f3de5.tar.xz
Allow to select videos to download by their upload dates (related #137)
Only absolute dates.
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index d0378fb14..2db686d62 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -89,6 +89,7 @@ class FileDownloader(object):
keepvideo: Keep the video file after post-processing
min_filesize: Skip files smaller than this size
max_filesize: Skip files larger than this size
+ daterange: A DateRange object, download only if the upload_date is in the range.
"""
params = None
@@ -424,6 +425,11 @@ class FileDownloader(object):
if rejecttitle:
if re.search(rejecttitle, title, re.IGNORECASE):
return u'"' + title + '" title matched reject pattern "' + rejecttitle + '"'
+ date = info_dict.get('upload_date', None)
+ if date is not None:
+ 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)
return None
def extract_info(self, url, download = True, ie_name = None):