2014-07-26 14:35:23 +03:00
|
|
|
|
# coding: utf-8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2015-06-06 02:54:57 +03:00
|
|
|
|
from ..compat import compat_urllib_parse_unquote
|
2014-08-01 19:08:09 +07:00
|
|
|
|
from ..utils import (
|
2014-11-05 01:00:33 +02:00
|
|
|
|
int_or_none,
|
2014-08-01 19:08:09 +07:00
|
|
|
|
str_to_int,
|
|
|
|
|
)
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IzleseneIE(InfoExtractor):
|
2014-09-10 00:22:48 +03:00
|
|
|
|
_VALID_URL = r'''(?x)
|
|
|
|
|
https?://(?:(?:www|m)\.)?izlesene\.com/
|
|
|
|
|
(?:video|embedplayer)/(?:[^/]+/)?(?P<id>[0-9]+)
|
|
|
|
|
'''
|
|
|
|
|
_TESTS = [
|
|
|
|
|
{
|
|
|
|
|
'url': 'http://www.izlesene.com/video/sevincten-cildirtan-dogum-gunu-hediyesi/7599694',
|
|
|
|
|
'md5': '4384f9f0ea65086734b881085ee05ac2',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '7599694',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'Sevinçten Çıldırtan Doğum Günü Hediyesi',
|
|
|
|
|
'thumbnail': 're:^http://.*\.jpg',
|
2015-10-03 16:05:29 +01:00
|
|
|
|
'duration': 95395,
|
2014-09-10 00:22:48 +03:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'url': 'http://www.izlesene.com/video/tarkan-dortmund-2006-konseri/17997',
|
|
|
|
|
'md5': '97f09b6872bffa284cb7fa4f6910cb72',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '17997',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'Tarkan Dortmund 2006 Konseri',
|
|
|
|
|
'thumbnail': 're:^http://.*\.jpg',
|
2015-10-03 16:05:29 +01:00
|
|
|
|
'duration': 253666,
|
2014-09-10 00:22:48 +03:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
]
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-11-05 01:00:33 +02:00
|
|
|
|
video_id = self._match_id(url)
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
2015-10-03 16:05:29 +01:00
|
|
|
|
api_data = self._download_json('http://panel.izlesene.com/api/playerJson/izlesene/%s' % video_id, video_id)
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
2015-10-03 16:05:29 +01:00
|
|
|
|
title = api_data['videoname']
|
|
|
|
|
thumbnail = api_data.get('thumbnail')
|
|
|
|
|
duration = int_or_none(api_data.get('videoduration'))
|
|
|
|
|
view_count = int_or_none(str_to_int(api_data.get('views')))
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
|
|
|
|
# Might be empty for some videos.
|
2015-10-03 16:05:29 +01:00
|
|
|
|
streams = api_data.get('qualitylevel')
|
2014-07-26 14:35:23 +03:00
|
|
|
|
|
|
|
|
|
formats = []
|
2015-10-03 16:05:29 +01:00
|
|
|
|
# TODO: extract formats from dash manifest
|
2014-09-10 00:22:48 +03:00
|
|
|
|
if streams:
|
|
|
|
|
for stream in streams.split('|'):
|
|
|
|
|
quality, url = re.search(r'\[(\w+)\](.+)', stream).groups()
|
|
|
|
|
formats.append({
|
|
|
|
|
'format_id': '%sp' % quality if quality else 'sd',
|
2015-10-03 16:05:29 +01:00
|
|
|
|
'url': url,
|
2014-09-10 00:22:48 +03:00
|
|
|
|
})
|
|
|
|
|
else:
|
2015-10-03 16:05:29 +01:00
|
|
|
|
stream_url = api_data.get('streamurl')
|
2014-07-26 14:35:23 +03:00
|
|
|
|
formats.append({
|
2014-09-10 00:22:48 +03:00
|
|
|
|
'format_id': 'sd',
|
2015-10-03 16:05:29 +01:00
|
|
|
|
'url': stream_url,
|
2014-07-26 14:35:23 +03:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
|
|
|
|
'title': title,
|
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
|
'duration': duration,
|
2015-10-03 16:05:29 +01:00
|
|
|
|
'view_count': view_count,
|
2014-08-01 19:08:09 +07:00
|
|
|
|
'formats': formats,
|
2014-07-26 14:35:23 +03:00
|
|
|
|
}
|