2014-10-01 14:45:35 -06:00
|
|
|
import re
|
|
|
|
|
2015-02-17 13:23:09 -07:00
|
|
|
from .common import InfoExtractor
|
2014-10-07 09:23:05 -06:00
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
2024-05-26 13:27:21 -06:00
|
|
|
xpath_text,
|
2014-10-07 09:23:05 -06:00
|
|
|
)
|
2014-10-01 14:45:35 -06:00
|
|
|
|
|
|
|
|
2015-02-17 13:23:09 -07:00
|
|
|
class WallaIE(InfoExtractor):
|
2016-03-21 09:36:32 -06:00
|
|
|
_VALID_URL = r'https?://vod\.walla\.co\.il/[^/]+/(?P<id>\d+)/(?P<display_id>.+)'
|
2014-10-01 14:45:35 -06:00
|
|
|
_TEST = {
|
|
|
|
'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '2642630',
|
2014-10-07 09:23:05 -06:00
|
|
|
'display_id': 'one-direction-all-for-one',
|
2014-10-01 14:45:35 -06:00
|
|
|
'ext': 'flv',
|
|
|
|
'title': 'וואן דיירקשן: ההיסטריה',
|
2014-10-07 09:23:05 -06:00
|
|
|
'description': 'md5:de9e2512a92442574cdb0913c49bc4d8',
|
2017-01-02 05:08:07 -07:00
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
2014-10-07 09:23:05 -06:00
|
|
|
'duration': 3600,
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
# rtmp download
|
|
|
|
'skip_download': True,
|
2024-06-11 17:09:58 -06:00
|
|
|
},
|
2014-10-01 14:45:35 -06:00
|
|
|
}
|
|
|
|
|
2014-10-07 09:23:05 -06:00
|
|
|
_SUBTITLE_LANGS = {
|
|
|
|
'עברית': 'heb',
|
|
|
|
}
|
|
|
|
|
2014-10-01 14:45:35 -06:00
|
|
|
def _real_extract(self, url):
|
2021-08-18 19:41:24 -06:00
|
|
|
mobj = self._match_valid_url(url)
|
2014-10-01 14:45:35 -06:00
|
|
|
video_id = mobj.group('id')
|
2014-10-07 09:23:05 -06:00
|
|
|
display_id = mobj.group('display_id')
|
2014-10-01 14:45:35 -06:00
|
|
|
|
2014-10-07 09:23:05 -06:00
|
|
|
video = self._download_xml(
|
2024-06-11 17:09:58 -06:00
|
|
|
f'http://video2.walla.co.il/?w=null/null/{video_id}/@@/video/flv_pl',
|
2014-10-07 09:23:05 -06:00
|
|
|
display_id)
|
2014-10-01 14:45:35 -06:00
|
|
|
|
2014-10-07 09:23:05 -06:00
|
|
|
item = video.find('./items/item')
|
2014-10-01 14:45:35 -06:00
|
|
|
|
2014-10-07 09:23:05 -06:00
|
|
|
title = xpath_text(item, './title', 'title')
|
|
|
|
description = xpath_text(item, './synopsis', 'description')
|
|
|
|
thumbnail = xpath_text(item, './preview_pic', 'thumbnail')
|
|
|
|
duration = int_or_none(xpath_text(item, './duration', 'duration'))
|
2014-10-01 14:45:35 -06:00
|
|
|
|
|
|
|
subtitles = {}
|
2014-10-07 09:23:05 -06:00
|
|
|
for subtitle in item.findall('./subtitles/subtitle'):
|
|
|
|
lang = xpath_text(subtitle, './title')
|
2015-02-17 13:23:09 -07:00
|
|
|
subtitles[self._SUBTITLE_LANGS.get(lang, lang)] = [{
|
|
|
|
'ext': 'srt',
|
|
|
|
'url': xpath_text(subtitle, './src'),
|
|
|
|
}]
|
2014-10-07 09:23:05 -06:00
|
|
|
|
|
|
|
formats = []
|
|
|
|
for quality in item.findall('./qualities/quality'):
|
|
|
|
format_id = xpath_text(quality, './title')
|
|
|
|
fmt = {
|
|
|
|
'url': 'rtmp://wafla.walla.co.il/vod',
|
|
|
|
'play_path': xpath_text(quality, './src'),
|
|
|
|
'player_url': 'http://isc.walla.co.il/w9/swf/video_swf/vod/WallaMediaPlayerAvod.swf',
|
|
|
|
'page_url': url,
|
|
|
|
'ext': 'flv',
|
|
|
|
'format_id': xpath_text(quality, './title'),
|
|
|
|
}
|
|
|
|
m = re.search(r'^(?P<height>\d+)[Pp]', format_id)
|
|
|
|
if m:
|
|
|
|
fmt['height'] = int(m.group('height'))
|
|
|
|
formats.append(fmt)
|
2014-10-01 14:45:35 -06:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
2014-10-07 09:23:05 -06:00
|
|
|
'display_id': display_id,
|
2014-10-01 14:45:35 -06:00
|
|
|
'title': title,
|
2014-10-07 09:23:05 -06:00
|
|
|
'description': description,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'duration': duration,
|
|
|
|
'formats': formats,
|
2014-10-01 14:45:35 -06:00
|
|
|
'subtitles': subtitles,
|
2014-10-07 09:23:05 -06:00
|
|
|
}
|