2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import get_element_by_id, parse_iso8601, determine_ext, int_or_none
10 class IzleseneIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.|m\.)?izlesene\.com/(?:video|embedplayer)/(?:[^/]+/)?(?P<id>[0-9]+)'
12 _STREAM_URL = 'http://panel.izlesene.com/api/streamurl/{id:}/{format:}'
14 'url': 'http://www.izlesene.com/video/sevincten-cildirtan-dogum-gunu-hediyesi/7599694',
15 'md5': '4384f9f0ea65086734b881085ee05ac2',
18 'title': u'Sevinçten Çıldırtan Doğum Günü Hediyesi',
19 'upload_date': '20140702',
20 'uploader_id': 'pelikzzle',
21 'description': u'Annesi oğluna doğum günü hediyesi olarak minecraft cd si alıyor, ve çocuk hunharca seviniyor',
22 'timestamp': 1404298698,
25 'thumbnail': 're:^http://.*\.jpg',
30 def _real_extract(self, url):
31 mobj = re.match(self._VALID_URL, url)
32 video_id = mobj.group('id')
33 url = 'http://www.izlesene.com/video/%s' % video_id
35 webpage = self._download_webpage(url, video_id)
37 title = self._og_search_title(webpage)
38 description = self._og_search_description(webpage)
39 thumbnail = self._og_search_thumbnail(webpage)
41 self._html_search_regex(
42 r'"videoduration"\s?:\s?"([^"]+)"', webpage, 'duration',
43 fatal=False, default='0')
45 view_count = get_element_by_id('videoViewCount',
46 webpage).replace('.', '')
47 timestamp = parse_iso8601(self._html_search_meta('uploadDate', webpage,
48 'upload date', fatal=False))
49 family_friendly = self._html_search_meta('isFamilyFriendly', webpage,
50 'age limit', fatal=False)
51 uploader = self._html_search_regex(r"adduserUsername\s?=\s?'([^']+)';",
52 webpage, 'uploader', fatal=False,
54 comment_count = self._html_search_regex(
55 r'comment_count\s?=\s?\'([^\']+)\';',
56 webpage, 'uploader', fatal=False)
58 content_url = self._html_search_meta('contentURL', webpage,
59 'content URL', fatal=False)
60 ext = determine_ext(content_url)
62 # Might be empty for some videos.
63 qualities = self._html_search_regex(r'"quality"\s?:\s?"([^"]+)"',
64 webpage, 'qualities', fatal=False,
68 for quality in qualities.split('|'):
69 json = self._download_json(
70 self._STREAM_URL.format(id=video_id, format=quality), video_id,
71 note=u'Getting video URL for "%s" quality' % quality,
72 errnote=u'Failed to get video URL for "%s" quality' % quality
74 video_format = '%sp' % quality if quality else 'sd'
76 'url': json.get('streamurl'),
78 'format': video_format,
79 'format_id': video_format,
86 'description': description,
87 'thumbnail': thumbnail,
89 'view_count': int_or_none(view_count),
90 'timestamp': timestamp,
91 'age_limit': 18 if family_friendly == 'False' else 0,
92 'uploader_id': uploader,
93 'comment_count': int_or_none(comment_count),