[utils] Handle rd-suffixed day parts in unified_strdate (#23199)
authorInfernalUnderling <42065091+InfernalUnderling@users.noreply.github.com>
Tue, 26 Nov 2019 17:08:37 +0000 (17:08 +0000)
committerSergey M <dstftw@gmail.com>
Tue, 26 Nov 2019 17:08:37 +0000 (00:08 +0700)
test/test_utils.py
youtube_dl/utils.py

index 3920542bb4381821b71306b26a5322f0bfe43c2a..0db37d9d88e9b40fc56fafd8e4f998925243231c 100644 (file)
@@ -340,6 +340,8 @@ class TestUtil(unittest.TestCase):
         self.assertEqual(unified_strdate('July 15th, 2013'), '20130715')
         self.assertEqual(unified_strdate('September 1st, 2013'), '20130901')
         self.assertEqual(unified_strdate('Sep 2nd, 2013'), '20130902')
         self.assertEqual(unified_strdate('July 15th, 2013'), '20130715')
         self.assertEqual(unified_strdate('September 1st, 2013'), '20130901')
         self.assertEqual(unified_strdate('Sep 2nd, 2013'), '20130902')
+        self.assertEqual(unified_strdate('November 3rd, 2019'), '20191103')
+        self.assertEqual(unified_strdate('October 23rd, 2005'), '20051023')
 
     def test_unified_timestamps(self):
         self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)
 
     def test_unified_timestamps(self):
         self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)
index aed988b884b69c269638d179ad5d15070a1ae260..0d30075aa1dd982a6b0a95e717575ce217453533 100644 (file)
@@ -1718,13 +1718,16 @@ DATE_FORMATS = (
     '%B %d %Y',
     '%B %dst %Y',
     '%B %dnd %Y',
     '%B %d %Y',
     '%B %dst %Y',
     '%B %dnd %Y',
+    '%B %drd %Y',
     '%B %dth %Y',
     '%b %d %Y',
     '%b %dst %Y',
     '%b %dnd %Y',
     '%B %dth %Y',
     '%b %d %Y',
     '%b %dst %Y',
     '%b %dnd %Y',
+    '%b %drd %Y',
     '%b %dth %Y',
     '%b %dst %Y %I:%M',
     '%b %dnd %Y %I:%M',
     '%b %dth %Y',
     '%b %dst %Y %I:%M',
     '%b %dnd %Y %I:%M',
+    '%b %drd %Y %I:%M',
     '%b %dth %Y %I:%M',
     '%Y %m %d',
     '%Y-%m-%d',
     '%b %dth %Y %I:%M',
     '%Y %m %d',
     '%Y-%m-%d',