1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-23 00:07:49 +00:00

[youtube] Fix extraction of like and dislike count (fixes #3633)

This commit is contained in:
Jaime Marquínez Ferrándiz 2014-08-31 12:38:00 +02:00
parent b170935a8f
commit f30a38be8b

View file

@ -813,15 +813,15 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
else: else:
video_description = u'' video_description = u''
def _extract_count(klass): def _extract_count(count_name):
count = self._search_regex( count = self._search_regex(
r'class="%s">([\d,]+)</span>' % re.escape(klass), r'id="watch-%s"[^>]*>.*?([\d,]+)\s*</span>' % re.escape(count_name),
video_webpage, klass, default=None) video_webpage, count_name, default=None)
if count is not None: if count is not None:
return int(count.replace(',', '')) return int(count.replace(',', ''))
return None return None
like_count = _extract_count(u'likes-count') like_count = _extract_count(u'like')
dislike_count = _extract_count(u'dislikes-count') dislike_count = _extract_count(u'dislike')
# subtitles # subtitles
video_subtitles = self.extract_subtitles(video_id, video_webpage) video_subtitles = self.extract_subtitles(video_id, video_webpage)