[YouPorn] Improve `upload_date` extraction
authordirkf <fieldhouse@gmx.net>
Sat, 28 May 2022 12:54:32 +0000 (13:54 +0100)
committerdirkf <fieldhouse@gmx.net>
Sat, 28 May 2022 12:54:32 +0000 (13:54 +0100)
See https://github.com/yt-dlp/yt-dlp/issues/2701#issuecomment-1034341883

youtube_dl/extractor/youporn.py

index 7084d3d1215e320056a61e6d2e1b124d1b4fb6a2..31e8abb72985a52f649e46ac1ccd7396cfdb4dc7 100644 (file)
@@ -1,3 +1,4 @@
+# coding: utf-8
 from __future__ import unicode_literals
 
 import re
@@ -137,9 +138,10 @@ class YouPornIE(InfoExtractor):
             r'(?s)<div[^>]+class=["\']submitByLink["\'][^>]*>(.+?)</div>',
             webpage, 'uploader', fatal=False)
         upload_date = unified_strdate(self._html_search_regex(
-            [r'UPLOADED:\s*<span>([^<]+)',
+            (r'UPLOADED:\s*<span>([^<]+)',
              r'Date\s+[Aa]dded:\s*<span>([^<]+)',
-             r'(?s)<div[^>]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)</div>'],
+             r'''(?s)<div[^>]+class=["']videoInfo(?:Date|Time)\b[^>]*>(.+?)</div>''',
+             r'(?s)<label\b[^>]*>Uploaded[^<]*</label>\s*<span\b[^>]*>(.+?)</span>'),
             webpage, 'upload date', fatal=False))
 
         age_limit = self._rta_search(webpage)