1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-23 00:02:24 +00:00

[onetpl] Add support for videos embedded via pulsembed (closes #13482)

This commit is contained in:
Sergey M․ 2017-06-24 18:33:31 +07:00
parent 73af5cc817
commit bd65f18153
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -11,6 +11,7 @@ from ..utils import (
get_element_by_class, get_element_by_class,
int_or_none, int_or_none,
js_to_json, js_to_json,
NO_DEFAULT,
parse_iso8601, parse_iso8601,
remove_start, remove_start,
strip_or_none, strip_or_none,
@ -198,6 +199,19 @@ class OnetPlIE(InfoExtractor):
'upload_date': '20170214', 'upload_date': '20170214',
'timestamp': 1487078046, 'timestamp': 1487078046,
}, },
}, {
# embedded via pulsembed
'url': 'http://film.onet.pl/pensjonat-nad-rozlewiskiem-relacja-z-planu-serialu/y428n0',
'info_dict': {
'id': '501235.965429946',
'ext': 'mp4',
'title': '"Pensjonat nad rozlewiskiem": relacja z planu serialu',
'upload_date': '20170622',
'timestamp': 1498159955,
},
'params': {
'skip_download': True,
},
}, { }, {
'url': 'http://film.onet.pl/zwiastuny/ghost-in-the-shell-drugi-zwiastun-pl/5q6yl3', 'url': 'http://film.onet.pl/zwiastuny/ghost-in-the-shell-drugi-zwiastun-pl/5q6yl3',
'only_matching': True, 'only_matching': True,
@ -212,13 +226,25 @@ class OnetPlIE(InfoExtractor):
'only_matching': True, 'only_matching': True,
}] }]
def _search_mvp_id(self, webpage, default=NO_DEFAULT):
return self._search_regex(
r'data-(?:params-)?mvp=["\'](\d+\.\d+)', webpage, 'mvp id',
default=default)
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
mvp_id = self._search_regex( mvp_id = self._search_mvp_id(webpage, default=None)
r'data-params-mvp=["\'](\d+\.\d+)', webpage, 'mvp id')
if not mvp_id:
pulsembed_url = self._search_regex(
r'data-src=(["\'])(?P<url>(?:https?:)?//pulsembed\.eu/.+?)\1',
webpage, 'pulsembed url', group='url')
webpage = self._download_webpage(
pulsembed_url, video_id, 'Downloading pulsembed webpage')
mvp_id = self._search_mvp_id(webpage)
return self.url_result( return self.url_result(
'onetmvp:%s' % mvp_id, OnetMVPIE.ie_key(), video_id=mvp_id) 'onetmvp:%s' % mvp_id, OnetMVPIE.ie_key(), video_id=mvp_id)