mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-03 04:42:52 +08:00
[pornhub] Correctly parse categories and tags (#13720)
This commit is contained in:
parent
c99d6890cb
commit
481d8ec6aa
@ -197,16 +197,9 @@ class PornHubIE(InfoExtractor):
|
||||
r'<span class="votesDown">([\d,\.]+)</span>', webpage, 'dislike')
|
||||
comment_count = self._extract_count(
|
||||
r'All Comments\s*<span>\(([\d,.]+)\)', webpage, 'comment')
|
||||
|
||||
page_params = self._parse_json(self._search_regex(
|
||||
r'page_params\.zoneDetails\[([\'"])[^\'"]+\1\]\s*=\s*(?P<data>{[^}]+})',
|
||||
webpage, 'page parameters', group='data', default='{}'),
|
||||
video_id, transform_source=js_to_json, fatal=False)
|
||||
tags = categories = None
|
||||
if page_params:
|
||||
tags = page_params.get('tags', '').split(',')
|
||||
categories = page_params.get('categories', '').split(',')
|
||||
|
||||
categories = re.findall(r"onclick=\"ga\('send', 'event', 'Watch Page', 'click', 'Category'\);\">([^<]+)<", webpage)
|
||||
tags = re.findall(r'<a href="/video/search\?search=[^"]+">([^<]+)<', webpage)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'url': video_url,
|
||||
|
Loading…
Reference in New Issue
Block a user