youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit 026fcc04956f2077a50cd4b4e9b87f45d2bcddea
parent 81c2f20b5386d89a62dc27293654d75b77f47473
Author: Philipp Hagemeister <phihag@phihag.de>
Date:   Sun,  9 Feb 2014 18:09:57 +0100

Fix #2355 (date parsing with dashes)

Diffstat:
Mtest/test_utils.py | 1+
Myoutube_dl/utils.py | 4++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/test_utils.py b/test/test_utils.py @@ -127,6 +127,7 @@ class TestUtil(unittest.TestCase): self.assertEqual(unified_strdate('8/7/2009'), '20090708') self.assertEqual(unified_strdate('Dec 14, 2012'), '20121214') self.assertEqual(unified_strdate('2012/10/11 01:56:38 +0000'), '20121011') + self.assertEqual(unified_strdate('1968-12-10'), '19681210') def test_find_xpath_attr(self): testxml = u'''<root> diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py @@ -756,9 +756,9 @@ def unified_strdate(date_str): """Return a string with the date in the format YYYYMMDD""" upload_date = None #Replace commas - date_str = date_str.replace(',',' ') + date_str = date_str.replace(',', ' ') # %z (UTC offset) is only supported in python>=3.2 - date_str = re.sub(r' ?(\+|-)[0-9:]*$', '', date_str) + date_str = re.sub(r' ?(\+|-)[0-9]{2}:?[0-9]{2}$', '', date_str) format_expressions = [ '%d %B %Y', '%B %d %Y',