X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=youtube_dl%2Fextractor%2Fkontrtube.py;h=5341ac773f79fe237626bdfe3243bd1561d8003d;hb=191b7cbba95679b389a509420993af56ef51545d;hp=1b45b67b0579d9fb06462f587651bc8f83e4751d;hpb=b542d4bbd7c620e35b2d61cf11827665372d8ff5;p=youtube-dl
diff --git a/youtube_dl/extractor/kontrtube.py b/youtube_dl/extractor/kontrtube.py
index 1b45b67b0..5341ac773 100644
--- a/youtube_dl/extractor/kontrtube.py
+++ b/youtube_dl/extractor/kontrtube.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
+from ..utils import int_or_none
class KontrTubeIE(InfoExtractor):
@@ -32,27 +33,26 @@ class KontrTubeIE(InfoExtractor):
video_url = self._html_search_regex(r"video_url: '(.+?)/?',", webpage, 'video URL')
thumbnail = self._html_search_regex(r"preview_url: '(.+?)/?',", webpage, 'video thumbnail', fatal=False)
- title = self._html_search_regex(r'
(.+?) - ТÑÑба зовÑÑ - ÐнÑеÑеÑнÑй видеоÑ
оÑÑинг', webpage,
- 'video title')
+ title = self._html_search_regex(
+ r'(.+?) - ТÑÑба зовÑÑ - ÐнÑеÑеÑнÑй видеоÑ
оÑÑинг', webpage, 'video title')
description = self._html_search_meta('description', webpage, 'video description')
- mobj = re.search(r'ÐлиÑелÑноÑÑÑ: (?P\d+)м:(?P\d+)Ñ
',
- webpage)
+ mobj = re.search(
+ r'ÐлиÑелÑноÑÑÑ: (?P\d+)м:(?P\d+)Ñ
', webpage)
duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
- view_count = self._html_search_regex(r'ÐÑоÑмоÑÑов: (\d+)
', webpage,
- 'view count', fatal=False)
- view_count = int(view_count) if view_count is not None else None
+ view_count = self._html_search_regex(
+ r'ÐÑоÑмоÑÑов: (\d+)
', webpage, 'view count', fatal=False)
comment_count = None
- comment_str = self._html_search_regex(r'ÐомменÑаÑии: ([^<]+)', webpage, 'comment count',
- fatal=False)
+ comment_str = self._html_search_regex(
+ r'ÐомменÑаÑии: ([^<]+)', webpage, 'comment count', fatal=False)
if comment_str.startswith('комменÑаÑиев неÑ'):
comment_count = 0
else:
mobj = re.search(r'\d+ из (?P\d+) комменÑаÑиев', comment_str)
if mobj:
- comment_count = int(mobj.group('total'))
+ comment_count = mobj.group('total')
return {
'id': video_id,
@@ -61,6 +61,6 @@ class KontrTubeIE(InfoExtractor):
'title': title,
'description': description,
'duration': duration,
- 'view_count': view_count,
- 'comment_count': comment_count,
+ 'view_count': int_or_none(view_count),
+ 'comment_count': int_or_none(comment_count),
}
\ No newline at end of file