]>
Commit | Line | Data |
---|---|---|
97d2db01 | 1 | from .common import InfoExtractor |
3e490836 | 2 | from ..compat import compat_str |
1cc79574 | 3 | from ..utils import ( |
3e490836 RA |
4 | int_or_none, |
5 | parse_duration, | |
6 | xpath_text, | |
97d2db01 PH |
7 | ) |
8 | ||
9 | ||
10 | class MySpassIE(InfoExtractor): | |
b72270d2 | 11 | _VALID_URL = r'https?://(?:www\.)?myspass\.de/(?:[^/]+/)*(?P<id>\d+)/?[^/]*$' |
12 | _TESTS = [{ | |
fb2a706d | 13 | 'url': 'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrheit/Absolute-Mehrheit-vom-17022013-Die-Highlights-Teil-2--/11741/', |
fb2a706d JMF |
14 | 'md5': '0b49f4844a068f8b33f4b7c88405862b', |
15 | 'info_dict': { | |
ef89dba5 PH |
16 | 'id': '11741', |
17 | 'ext': 'mp4', | |
b72270d2 | 18 | 'description': 'md5:9f0db5044c8fe73f528a390498f7ce9b', |
3e490836 | 19 | 'title': '17.02.2013 - Die Highlights, Teil 2', |
b72270d2 | 20 | 'thumbnail': r're:.*\.jpg', |
21 | 'duration': 323.0, | |
22 | 'episode': '17.02.2013 - Die Highlights, Teil 2', | |
23 | 'season_id': '544', | |
24 | 'episode_number': 1, | |
25 | 'series': 'Absolute Mehrheit', | |
26 | 'season_number': 2, | |
27 | 'season': 'Season 2', | |
28 | }, | |
29 | }, | |
30 | { | |
31 | 'url': 'https://www.myspass.de/shows/tvshows/tv-total/Novak-Puffovic-bei-bester-Laune--/44996/', | |
32 | 'md5': 'eb28b7c5e254192046e86ebaf7deac8f', | |
33 | 'info_dict': { | |
34 | 'id': '44996', | |
35 | 'ext': 'mp4', | |
36 | 'description': 'md5:74c7f886e00834417f1e427ab0da6121', | |
37 | 'title': 'Novak Puffovic bei bester Laune', | |
38 | 'thumbnail': r're:.*\.jpg', | |
39 | 'episode_number': 8, | |
40 | 'episode': 'Novak Puffovic bei bester Laune', | |
41 | 'series': 'TV total', | |
42 | 'season': 'Season 19', | |
43 | 'season_id': '987', | |
44 | 'duration': 2941.0, | |
45 | 'season_number': 19, | |
46 | }, | |
47 | }, | |
48 | { | |
49 | 'url': 'https://www.myspass.de/channels/tv-total-raabigramm/17033/20831/', | |
50 | 'md5': '7b293a6b9f3a7acdd29304c8d0dbb7cc', | |
51 | 'info_dict': { | |
52 | 'id': '20831', | |
53 | 'ext': 'mp4', | |
54 | 'description': 'Gefühle pur: Schaut euch die ungeschnittene Version von Stefans Liebesbeweis an die Moderationsgrazie von Welt, Verona Feldbusch, an.', | |
55 | 'title': 'Raabigramm Verona Feldbusch', | |
56 | 'thumbnail': r're:.*\.jpg', | |
57 | 'episode_number': 6, | |
58 | 'episode': 'Raabigramm Verona Feldbusch', | |
59 | 'series': 'TV total', | |
60 | 'season': 'Season 1', | |
61 | 'season_id': '34', | |
62 | 'duration': 105.0, | |
63 | 'season_number': 1, | |
fb2a706d | 64 | }, |
b72270d2 | 65 | }] |
97d2db01 PH |
66 | |
67 | def _real_extract(self, url): | |
3e490836 | 68 | video_id = self._match_id(url) |
97d2db01 | 69 | |
b72270d2 | 70 | metadata = self._download_xml('http://www.myspass.de/myspass/includes/apps/video/getvideometadataxml.php?id=' + video_id, video_id) |
3e490836 RA |
71 | |
72 | title = xpath_text(metadata, 'title', fatal=True) | |
73 | video_url = xpath_text(metadata, 'url_flv', 'download url', True) | |
74 | video_id_int = int(video_id) | |
b72270d2 | 75 | for group in self._search_regex(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url, 'myspass', group=(1, 2, 3), default=[]): |
3e490836 RA |
76 | group_int = int(group) |
77 | if group_int > video_id_int: | |
b72270d2 | 78 | video_url = video_url.replace(group, compat_str(group_int // video_id_int)) |
fb2a706d JMF |
79 | |
80 | return { | |
97d2db01 PH |
81 | 'id': video_id, |
82 | 'url': video_url, | |
83 | 'title': title, | |
3e490836 RA |
84 | 'thumbnail': xpath_text(metadata, 'imagePreview'), |
85 | 'description': xpath_text(metadata, 'description'), | |
86 | 'duration': parse_duration(xpath_text(metadata, 'duration')), | |
87 | 'series': xpath_text(metadata, 'format'), | |
88 | 'season_number': int_or_none(xpath_text(metadata, 'season')), | |
89 | 'season_id': xpath_text(metadata, 'season_id'), | |
90 | 'episode': title, | |
91 | 'episode_number': int_or_none(xpath_text(metadata, 'episode')), | |
97d2db01 | 92 | } |