1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-03 07:02:56 +08:00

[pornhub] Correctly parse categories and tags (#13720)

This commit is contained in:
burnersauce 2017-07-23 22:31:29 -04:00 committed by GitHub
parent c99d6890cb
commit 481d8ec6aa

View File

@ -197,15 +197,8 @@ 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,