]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tele5.py
d/rules: Drop makefile mangling
[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/(?:[^/]+/)*(?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/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
25 'only_matching': True,
26 }, {
27 'url': 'https://www.tele5.de/video-clip/?ve_id=1609440',
28 'only_matching': True,
29 }, {
30 'url': 'https://www.tele5.de/filme/schlefaz-dragon-crusaders/',
31 'only_matching': True,
32 }, {
33 'url': 'https://www.tele5.de/filme/making-of/avengers-endgame/',
34 'only_matching': True,
35 }, {
36 'url': 'https://www.tele5.de/star-trek/raumschiff-voyager/ganze-folge/das-vinculum/',
37 'only_matching': True,
38 }, {
39 'url': 'https://www.tele5.de/anders-ist-sevda/',
40 'only_matching': True,
41 }]
42
43 def _real_extract(self, url):
44 qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
45 video_id = (qs.get('vid') or qs.get('ve_id') or [None])[0]
46
47 if not video_id:
48 display_id = self._match_id(url)
49 webpage = self._download_webpage(url, display_id)
50 video_id = self._html_search_regex(
51 (r'id\s*=\s*["\']video-player["\'][^>]+data-id\s*=\s*["\'](\d+)',
52 r'\s+id\s*=\s*["\']player_(\d{6,})',
53 r'\bdata-id\s*=\s*["\'](\d{6,})'), webpage, 'video id')
54
55 return self.url_result(
56 'https://api.nexx.cloud/v3/759/videos/byid/%s' % video_id,
57 ie=NexxIE.ie_key(), video_id=video_id)