2 from __future__ import unicode_literals
6 from .common import InfoExtractor
16 class IzleseneIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:(?:www|m)\.)?izlesene\.com/(?:video|embedplayer)/(?:[^/]+/)?(?P<id>[0-9]+)'
18 _STREAM_URL = 'http://panel.izlesene.com/api/streamurl/{id:}/{format:}'
20 'url': 'http://www.izlesene.com/video/sevincten-cildirtan-dogum-gunu-hediyesi/7599694',
21 'md5': '4384f9f0ea65086734b881085ee05ac2',
25 'title': 'Sevinçten Çıldırtan Doğum Günü Hediyesi',
26 'description': 'Annesi oğluna doğum günü hediyesi olarak minecraft cd si alıyor, ve çocuk hunharca seviniyor',
27 'thumbnail': 're:^http://.*\.jpg',
28 'uploader_id': 'pelikzzle',
29 'timestamp': 1404298698,
30 'upload_date': '20140702',
36 def _real_extract(self, url):
37 mobj = re.match(self._VALID_URL, url)
38 video_id = mobj.group('id')
39 url = 'http://www.izlesene.com/video/%s' % video_id
41 webpage = self._download_webpage(url, video_id)
43 title = self._og_search_title(webpage)
44 description = self._og_search_description(webpage)
45 thumbnail = self._og_search_thumbnail(webpage)
47 uploader = self._html_search_regex(
48 r"adduserUsername\s*=\s*'([^']+)';", webpage, 'uploader', fatal=False, default='')
49 timestamp = parse_iso8601(self._html_search_meta(
50 'uploadDate', webpage, 'upload date', fatal=False))
52 duration = int_or_none(self._html_search_regex(
53 r'"videoduration"\s*:\s*"([^"]+)"', webpage, 'duration', fatal=False))
57 view_count = str_to_int(get_element_by_id('videoViewCount', webpage))
58 comment_count = self._html_search_regex(
59 r'comment_count\s*=\s*\'([^\']+)\';', webpage, 'uploader', fatal=False)
61 family_friendly = self._html_search_meta(
62 'isFamilyFriendly', webpage, 'age limit', fatal=False)
64 content_url = self._html_search_meta(
65 'contentURL', webpage, 'content URL', fatal=False)
66 ext = determine_ext(content_url, 'mp4')
68 # Might be empty for some videos.
69 qualities = self._html_search_regex(
70 r'"quality"\s*:\s*"([^"]+)"', webpage, 'qualities', fatal=False, default='')
73 for quality in qualities.split('|'):
74 json = self._download_json(
75 self._STREAM_URL.format(id=video_id, format=quality), video_id,
76 note='Getting video URL for "%s" quality' % quality,
77 errnote='Failed to get video URL for "%s" quality' % quality
80 'url': json.get('streamurl'),
82 'format_id': '%sp' % quality if quality else 'sd',
88 'description': description,
89 'thumbnail': thumbnail,
90 'uploader_id': uploader,
91 'timestamp': timestamp,
93 'view_count': int_or_none(view_count),
94 'comment_count': int_or_none(comment_count),
95 'age_limit': 18 if family_friendly == 'False' else 0,