]>
Commit | Line | Data |
---|---|---|
3e490836 | 1 | # coding: utf-8 |
fb2a706d | 2 | from __future__ import unicode_literals |
3e490836 RA |
3 | |
4 | import re | |
97d2db01 PH |
5 | |
6 | from .common import InfoExtractor | |
3e490836 | 7 | from ..compat import compat_str |
1cc79574 | 8 | from ..utils import ( |
3e490836 RA |
9 | int_or_none, |
10 | parse_duration, | |
11 | xpath_text, | |
97d2db01 PH |
12 | ) |
13 | ||
14 | ||
15 | class MySpassIE(InfoExtractor): | |
3e490836 | 16 | _VALID_URL = r'https?://(?:www\.)?myspass\.de/([^/]+/)*(?P<id>\d+)' |
6f5ac90c | 17 | _TEST = { |
fb2a706d | 18 | 'url': 'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrheit/Absolute-Mehrheit-vom-17022013-Die-Highlights-Teil-2--/11741/', |
fb2a706d JMF |
19 | 'md5': '0b49f4844a068f8b33f4b7c88405862b', |
20 | 'info_dict': { | |
ef89dba5 PH |
21 | 'id': '11741', |
22 | 'ext': 'mp4', | |
3e490836 RA |
23 | 'description': 'Wer kann in die Fußstapfen von Wolfgang Kubicki treten und die Mehrheit der Zuschauer hinter sich versammeln? Wird vielleicht sogar die Absolute Mehrheit geknackt und der Jackpot von 200.000 Euro mit nach Hause genommen?', |
24 | 'title': '17.02.2013 - Die Highlights, Teil 2', | |
fb2a706d | 25 | }, |
6f5ac90c | 26 | } |
97d2db01 PH |
27 | |
28 | def _real_extract(self, url): | |
3e490836 | 29 | video_id = self._match_id(url) |
97d2db01 | 30 | |
cfe5537e | 31 | metadata = self._download_xml( |
3e490836 RA |
32 | 'http://www.myspass.de/myspass/includes/apps/video/getvideometadataxml.php?id=' + video_id, |
33 | video_id) | |
34 | ||
35 | title = xpath_text(metadata, 'title', fatal=True) | |
36 | video_url = xpath_text(metadata, 'url_flv', 'download url', True) | |
37 | video_id_int = int(video_id) | |
38 | for group in re.search(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url).groups(): | |
39 | group_int = int(group) | |
40 | if group_int > video_id_int: | |
41 | video_url = video_url.replace( | |
42 | group, compat_str(group_int // video_id_int)) | |
fb2a706d JMF |
43 | |
44 | return { | |
97d2db01 PH |
45 | 'id': video_id, |
46 | 'url': video_url, | |
47 | 'title': title, | |
3e490836 RA |
48 | 'thumbnail': xpath_text(metadata, 'imagePreview'), |
49 | 'description': xpath_text(metadata, 'description'), | |
50 | 'duration': parse_duration(xpath_text(metadata, 'duration')), | |
51 | 'series': xpath_text(metadata, 'format'), | |
52 | 'season_number': int_or_none(xpath_text(metadata, 'season')), | |
53 | 'season_id': xpath_text(metadata, 'season_id'), | |
54 | 'episode': title, | |
55 | 'episode_number': int_or_none(xpath_text(metadata, 'episode')), | |
97d2db01 | 56 | } |