Fixed walla extractor, added site-wide video extraction
This commit is contained in:
parent
78c2e1c978
commit
8bc516c67b
@ -5,29 +5,43 @@ import re
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
xpath_text,
|
xpath_text,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class WallaIE(InfoExtractor):
|
class WallaIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://vod\.walla\.co\.il/[^/]+/(?P<id>\d+)/(?P<display_id>.+)'
|
_VALID_URL = r'http://[^\.]+\.walla\.co\.il/[^/]+/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
|
'url': 'http://news.walla.co.il/item/2835878',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2663876',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'בנט יורה: "בפעם הבאה יהיה רב ראשי אחד לישראל"',
|
||||||
|
'description': 'md5:5f3ac43a8abc132ccaa1a6894a137440',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg',
|
||||||
|
'duration': 112,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# stream download
|
||||||
|
'skip_download': True,
|
||||||
|
}
|
||||||
|
}, {
|
||||||
'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one',
|
'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2642630',
|
'id': '2642630',
|
||||||
'display_id': 'one-direction-all-for-one',
|
'ext': 'mp4',
|
||||||
'ext': 'flv',
|
|
||||||
'title': 'וואן דיירקשן: ההיסטריה',
|
'title': 'וואן דיירקשן: ההיסטריה',
|
||||||
'description': 'md5:de9e2512a92442574cdb0913c49bc4d8',
|
'description': 'md5:de9e2512a92442574cdb0913c49bc4d8',
|
||||||
'thumbnail': 're:^https?://.*\.jpg',
|
'thumbnail': 're:^https?://.*\.jpg',
|
||||||
'duration': 3600,
|
'duration': 3600,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# rtmp download
|
# stream download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
|
|
||||||
_SUBTITLE_LANGS = {
|
_SUBTITLE_LANGS = {
|
||||||
'עברית': 'heb',
|
'עברית': 'heb',
|
||||||
@ -36,18 +50,27 @@ class WallaIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
display_id = mobj.group('display_id')
|
|
||||||
|
|
||||||
video = self._download_xml(
|
video = self._download_xml(
|
||||||
'http://video2.walla.co.il/?w=null/null/%s/@@/video/flv_pl' % video_id,
|
'http://video.walla.co.il/?w=//%s/@@/video/flv_pl' % video_id,
|
||||||
display_id)
|
video_id)
|
||||||
|
|
||||||
item = video.find('./items/item')
|
item = video.find('./items/item')
|
||||||
|
|
||||||
|
if item is None:
|
||||||
|
raise ExtractorError('The item doesn\'t exist or has no video.', expected=True)
|
||||||
|
|
||||||
title = xpath_text(item, './title', 'title')
|
title = xpath_text(item, './title', 'title')
|
||||||
description = xpath_text(item, './synopsis', 'description')
|
description = next(
|
||||||
|
item for item in [
|
||||||
|
xpath_text(item, './synopsis', 'description'),
|
||||||
|
xpath_text(item, './subtitle', 'description'),
|
||||||
|
'',
|
||||||
|
] if item is not None
|
||||||
|
)
|
||||||
thumbnail = xpath_text(item, './preview_pic', 'thumbnail')
|
thumbnail = xpath_text(item, './preview_pic', 'thumbnail')
|
||||||
duration = int_or_none(xpath_text(item, './duration', 'duration'))
|
duration = int_or_none(xpath_text(item, './duration', 'duration'))
|
||||||
|
default_file = xpath_text(item, './src', 'src')
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for subtitle in item.findall('./subtitles/subtitle'):
|
for subtitle in item.findall('./subtitles/subtitle'):
|
||||||
@ -57,16 +80,23 @@ class WallaIE(InfoExtractor):
|
|||||||
'url': xpath_text(subtitle, './src'),
|
'url': xpath_text(subtitle, './src'),
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
playlist_url = 'http://walla-s.vidnt.com/walla_vod/_definst_/%s.mp4/playlist.m3u8'
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
formats.append(
|
||||||
|
{
|
||||||
|
'url': playlist_url % default_file,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 40,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
for quality in item.findall('./qualities/quality'):
|
for quality in item.findall('./qualities/quality'):
|
||||||
format_id = xpath_text(quality, './title')
|
format_id = xpath_text(quality, './title')
|
||||||
fmt = {
|
fmt = {
|
||||||
'url': 'rtmp://wafla.walla.co.il/vod',
|
'url': playlist_url % xpath_text(quality, './src'),
|
||||||
'play_path': xpath_text(quality, './src'),
|
'ext': 'mp4',
|
||||||
'player_url': 'http://isc.walla.co.il/w9/swf/video_swf/vod/WallaMediaPlayerAvod.swf',
|
'format_id': quality.attrib['type'],
|
||||||
'page_url': url,
|
|
||||||
'ext': 'flv',
|
|
||||||
'format_id': xpath_text(quality, './title'),
|
|
||||||
}
|
}
|
||||||
m = re.search(r'^(?P<height>\d+)[Pp]', format_id)
|
m = re.search(r'^(?P<height>\d+)[Pp]', format_id)
|
||||||
if m:
|
if m:
|
||||||
@ -76,7 +106,6 @@ class WallaIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user