]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tele5.py
debian/patch: Refresh all patches to avoid FTBFS.
[youtubedl] / youtube_dl / extractor / tele5.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from .nexx import NexxIE
6 from ..compat import compat_urlparse
7
8
9 class Tele5IE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:mediathek|tv)/(?P<id>[^?#&]+)'
11 _TESTS = [{
12 'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
13 'info_dict': {
14 'id': '1549416',
15 'ext': 'mp4',
16 'upload_date': '20180814',
17 'timestamp': 1534290623,
18 'title': 'Pandorum',
19 },
20 'params': {
21 'skip_download': True,
22 },
23 }, {
24 'url': 'https://www.tele5.de/tv/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
25 'only_matching': True,
26 }, {
27 'url': 'https://www.tele5.de/tv/dark-matter/videos',
28 'only_matching': True,
29 }]
30
31 def _real_extract(self, url):
32 qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
33 video_id = (qs.get('vid') or qs.get('ve_id') or [None])[0]
34
35 if not video_id:
36 display_id = self._match_id(url)
37 webpage = self._download_webpage(url, display_id)
38 video_id = self._html_search_regex(
39 r'id\s*=\s*["\']video-player["\'][^>]+data-id\s*=\s*["\'](\d+)',
40 webpage, 'video id')
41
42 return self.url_result(
43 'https://api.nexx.cloud/v3/759/videos/byid/%s' % video_id,
44 ie=NexxIE.ie_key(), video_id=video_id)