1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-24 04:56:55 +01:00

[drtuber] Fix extraction

This commit is contained in:
Sergey M․ 2015-07-01 21:47:56 +06:00
parent 33f1f81b8b
commit 86511ea417

View File

@ -36,25 +36,24 @@ class DrTuberIE(InfoExtractor):
r'<source src="([^"]+)"', webpage, 'video URL') r'<source src="([^"]+)"', webpage, 'video URL')
title = self._html_search_regex( title = self._html_search_regex(
[r'class="hd_title" style="[^"]+">([^<]+)</h1>', r'<title>([^<]+) - \d+'], [r'<p[^>]+class="title_substrate">([^<]+)</p>', r'<title>([^<]+) - \d+'],
webpage, 'title') webpage, 'title')
thumbnail = self._html_search_regex( thumbnail = self._html_search_regex(
r'poster="([^"]+)"', r'poster="([^"]+)"',
webpage, 'thumbnail', fatal=False) webpage, 'thumbnail', fatal=False)
like_count = str_to_int(self._html_search_regex( def extract_count(id_, name):
r'<span id="rate_likes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>', return str_to_int(self._html_search_regex(
webpage, 'like count', fatal=False)) r'<span[^>]+(?:class|id)="%s"[^>]*>([\d,\.]+)</span>' % id_,
dislike_count = str_to_int(self._html_search_regex( webpage, '%s count' % name, fatal=False))
r'<span id="rate_dislikes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>',
webpage, 'like count', fatal=False)) like_count = extract_count('rate_likes', 'like')
comment_count = str_to_int(self._html_search_regex( dislike_count = extract_count('rate_dislikes', 'dislike')
r'<span class="comments_count">([\d,\.]+)</span>', comment_count = extract_count('comments_count', 'comment')
webpage, 'comment count', fatal=False))
cats_str = self._search_regex( cats_str = self._search_regex(
r'<span>Categories:</span><div>(.+?)</div>', webpage, 'categories', fatal=False) r'<div[^>]+class="categories_list">(.+?)</div>', webpage, 'categories', fatal=False)
categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str) categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str)
return { return {