diff options
author | cazulu <jvlarapeinado@gmail.com> | 2016-02-16 18:45:53 +0900 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-02-18 20:31:43 +0600 |
commit | 411cb8f4769215ea6835895206782d8ec00a5114 (patch) | |
tree | e1778fb46e930bdd0cc05dc9d1a71491d4690704 /youtube_dl | |
parent | 63bf4f0dc0502a87c19863c2509a4bc28c7c1abb (diff) |
[dailymotion] Fix view count extraction
Fix view count parsing when the decimal marker is a whitespace, e.g. '101 101'
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/dailymotion.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py index 7ae9f2359..2e6226ea0 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( - [r'<meta[^>]+itemprop="interactionCount"[^>]+content="UserPlays:(\d+)"', - r'video_views_count[^>]+>\s+([\d\.,]+)'], - webpage, 'view count', fatal=False)) + view_count_str = self._search_regex( + (r'<meta[^>]+itemprop="interactionCount"[^>]+content="UserPlays:([\s\d,.]+)"', + r'video_views_count[^>]+>\s+([\s\d\,.]+)'), + webpage, 'view count', fatal=False) + if view_count_str: + view_count_str = re.sub(r'\s', '', view_count_str) + view_count = str_to_int(view_count_str) comment_count = int_or_none(self._search_regex( r'<meta[^>]+itemprop="interactionCount"[^>]+content="UserComments:(\d+)"', webpage, 'comment count', fatal=False)) |