Merge branch 'master' of github.com:rg3/youtube-dl
authorPhilipp Hagemeister <phihag@phihag.de>
Thu, 11 Dec 2014 15:23:01 +0000 (16:23 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Thu, 11 Dec 2014 15:23:01 +0000 (16:23 +0100)
youtube_dl/extractor/youtube.py
youtube_dl/utils.py

index 42441d9fa44fe6673a44988558ec218ad4dd20ee..6216028cf127852d18f4aedd9ac466342b302063 100644 (file)
@@ -14,23 +14,24 @@ from .common import InfoExtractor, SearchInfoExtractor
 from .subtitles import SubtitlesInfoExtractor
 from ..jsinterp import JSInterpreter
 from ..swfinterp import SWFInterpreter
-from ..utils import (
+from ..compat import (
     compat_chr,
     compat_parse_qs,
     compat_urllib_parse,
     compat_urllib_request,
     compat_urlparse,
     compat_str,
-
+)
+from ..utils import (
     clean_html,
-    get_element_by_id,
-    get_element_by_attribute,
     ExtractorError,
+    get_element_by_attribute,
+    get_element_by_id,
     int_or_none,
     OnDemandPagedList,
+    orderedSet,
     unescapeHTML,
     unified_strdate,
-    orderedSet,
     uppercase_escape,
 )
 
index a95d2c942f35dbbe1cd8402698b398b3a887d45a..75f9594e6c8abcecfe128af1be2e73575d6eecc1 100644 (file)
@@ -712,8 +712,10 @@ def date_from_str(date_str):
     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':
+    if date_str in ('now', 'today'):
         return today
+    if date_str == 'yesterday':
+        return today - datetime.timedelta(days=1)
     match = re.match('(now|today)(?P<sign>[+-])(?P<time>\d+)(?P<unit>day|week|month|year)(s)?', date_str)
     if match is not None:
         sign = match.group('sign')