From 38093b5292e861ba9a8e4c82976778db4e5f5b7d Mon Sep 17 00:00:00 2001 From: cazulu Date: Tue, 16 Feb 2016 18:45:53 +0900 Subject: [PATCH] Fixed dailymotion view_count parsing Fixed dailymotion view_count parsing when the decimal marker is a whitespace, e.g., '101 101' --- youtube_dl/extractor/dailymotion.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py index 7ae9f2359..3720e393b 100644 --- a/youtube_dl/extractor/dailymotion.py +++ b/youtube_dl/extractor/dailymotion.py @@ -122,10 +122,13 @@ class DailymotionIE(DailymotionBaseInfoExtractor): description = self._og_search_description(webpage) or self._html_search_meta( 'description', webpage, 'description') - view_count = str_to_int(self._search_regex( + view_count_str = self._search_regex( [r']+itemprop="interactionCount"[^>]+content="UserPlays:(\d+)"', - r'video_views_count[^>]+>\s+([\d\.,]+)'], - webpage, 'view count', fatal=False)) + r'video_views_count[^>]+>\s+([\d\.,\s]+)'], + webpage, 'view count', fatal=False) + if view_count_str and view_count_str.split: + view_count_str = ''.join(view_count_str.split()) + view_count = str_to_int(view_count_str) comment_count = int_or_none(self._search_regex( r']+itemprop="interactionCount"[^>]+content="UserComments:(\d+)"', webpage, 'comment count', fatal=False))