]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[porncom] Extract categories and tags (Closes #10510)
authorSergey M․ <dstftw@gmail.com>
Wed, 31 Aug 2016 15:23:55 +0000 (22:23 +0700)
committerSergey M․ <dstftw@gmail.com>
Wed, 31 Aug 2016 15:23:55 +0000 (22:23 +0700)
youtube_dl/extractor/porncom.py

index 4baf79688ad73f0a6d0f51e05d1bb01ddc36ea39..d85e0294df62d7540304f2a8e87c4f989fcc2e07 100644 (file)
@@ -26,6 +26,8 @@ class PornComIE(InfoExtractor):
             'duration': 551,
             'view_count': int,
             'age_limit': 18,
+            'categories': list,
+            'tags': list,
         },
     }, {
         'url': 'http://se.porn.com/videos/marsha-may-rides-seth-on-top-of-his-thick-cock-2658067',
@@ -75,7 +77,14 @@ class PornComIE(InfoExtractor):
         self._sort_formats(formats)
 
         view_count = str_to_int(self._search_regex(
-            r'class=["\']views["\'][^>]*><p>([\d,.]+)', webpage, 'view count'))
+            r'class=["\']views["\'][^>]*><p>([\d,.]+)', webpage,
+            'view count', fatal=False))
+
+        def extract_list(kind):
+            s = self._search_regex(
+                r'(?s)<p[^>]*>%s:(.+?)</p>' % kind.capitalize(),
+                webpage, kind, fatal=False)
+            return re.findall(r'<a[^>]+>([^<]+)</a>', s or '')
 
         return {
             'id': video_id,
@@ -86,4 +95,6 @@ class PornComIE(InfoExtractor):
             'view_count': view_count,
             'formats': formats,
             'age_limit': 18,
+            'categories': extract_list('categories'),
+            'tags': extract_list('tags'),
         }