X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Futils.py;h=6c5b5df4cc138254e0d7680ef7477fc0f11e6ed0;hb=6ce533a2205eec9cd94e12a6a8d281ed852b5091;hp=3a2f0022fb87f9c6426f295cbc5da214e6370b72;hpb=bf50b0383e4d6728bbbf1d0ee70cf586a90efb40;p=youtube-dl diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 3a2f0022f..6c5b5df4c 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -586,7 +586,29 @@ def unified_strdate(date_str): return upload_date def date_from_str(date_str): - """Return a datetime object from a string in the format YYYYMMDD""" + """ + Return a datetime object from a string in the format YYYYMMDD or + (now|today)[+-][0-9](day|week|month|year)(s)?""" + today = datetime.date.today() + if date_str == 'now'or date_str == 'today': + return today + match = re.match('(now|today)(?P[+-])(?P