[utils] Add more date formats
authorSergey M․ <dstftw@gmail.com>
Thu, 12 Jan 2017 15:39:45 +0000 (22:39 +0700)
committerSergey M․ <dstftw@gmail.com>
Thu, 12 Jan 2017 15:39:45 +0000 (22:39 +0700)
test/test_utils.py
youtube_dl/utils.py

index 3092db5c165b64e2e1e4bfbb49da2d75c924bae3..e99bf794e4e44ce58e1d13a4af947adeaff964f7 100644 (file)
@@ -295,6 +295,9 @@ class TestUtil(unittest.TestCase):
         self.assertEqual(unified_strdate('27.02.2016 17:30'), '20160227')
         self.assertEqual(unified_strdate('UNKNOWN DATE FORMAT'), None)
         self.assertEqual(unified_strdate('Feb 7, 2016 at 6:35 pm'), '20160207')
+        self.assertEqual(unified_strdate('July 15th, 2013'), '20130715')
+        self.assertEqual(unified_strdate('September 1st, 2013'), '20130901')
+        self.assertEqual(unified_strdate('Sep 2nd, 2013'), '20130902')
 
     def test_unified_timestamps(self):
         self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)
index 39dd6c49f5d80022a913a03bfc90369971396b1f..12863e74acd51b3f6b3ec6467f23f76227d0f18f 100644 (file)
@@ -128,7 +128,13 @@ DATE_FORMATS = (
     '%d %B %Y',
     '%d %b %Y',
     '%B %d %Y',
+    '%B %dst %Y',
+    '%B %dnd %Y',
+    '%B %dth %Y',
     '%b %d %Y',
+    '%b %dst %Y',
+    '%b %dnd %Y',
+    '%b %dth %Y',
     '%b %dst %Y %I:%M',
     '%b %dnd %Y %I:%M',
     '%b %dth %Y %I:%M',