Skip to content

Commit b72270d

Browse files
authored
[MySpass] Fix video url processing (yt-dlp#2510)
Closes yt-dlp#2507 Authored by: trassshhub
1 parent 706dfe4 commit b72270d

File tree

1 file changed

+51
-12
lines changed

1 file changed

+51
-12
lines changed

yt_dlp/extractor/myspass.py

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# coding: utf-8
22
from __future__ import unicode_literals
33

4-
import re
5-
64
from .common import InfoExtractor
75
from ..compat import compat_str
86
from ..utils import (
@@ -13,33 +11,74 @@
1311

1412

1513
class MySpassIE(InfoExtractor):
16-
_VALID_URL = r'https?://(?:www\.)?myspass\.de/([^/]+/)*(?P<id>\d+)'
17-
_TEST = {
14+
_VALID_URL = r'https?://(?:www\.)?myspass\.de/(?:[^/]+/)*(?P<id>\d+)/?[^/]*$'
15+
_TESTS = [{
1816
'url': 'http://www.myspass.de/myspass/shows/tvshows/absolute-mehrheit/Absolute-Mehrheit-vom-17022013-Die-Highlights-Teil-2--/11741/',
1917
'md5': '0b49f4844a068f8b33f4b7c88405862b',
2018
'info_dict': {
2119
'id': '11741',
2220
'ext': 'mp4',
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?',
21+
'description': 'md5:9f0db5044c8fe73f528a390498f7ce9b',
2422
'title': '17.02.2013 - Die Highlights, Teil 2',
23+
'thumbnail': r're:.*\.jpg',
24+
'duration': 323.0,
25+
'episode': '17.02.2013 - Die Highlights, Teil 2',
26+
'season_id': '544',
27+
'episode_number': 1,
28+
'series': 'Absolute Mehrheit',
29+
'season_number': 2,
30+
'season': 'Season 2',
31+
},
32+
},
33+
{
34+
'url': 'https://www.myspass.de/shows/tvshows/tv-total/Novak-Puffovic-bei-bester-Laune--/44996/',
35+
'md5': 'eb28b7c5e254192046e86ebaf7deac8f',
36+
'info_dict': {
37+
'id': '44996',
38+
'ext': 'mp4',
39+
'description': 'md5:74c7f886e00834417f1e427ab0da6121',
40+
'title': 'Novak Puffovic bei bester Laune',
41+
'thumbnail': r're:.*\.jpg',
42+
'episode_number': 8,
43+
'episode': 'Novak Puffovic bei bester Laune',
44+
'series': 'TV total',
45+
'season': 'Season 19',
46+
'season_id': '987',
47+
'duration': 2941.0,
48+
'season_number': 19,
49+
},
50+
},
51+
{
52+
'url': 'https://www.myspass.de/channels/tv-total-raabigramm/17033/20831/',
53+
'md5': '7b293a6b9f3a7acdd29304c8d0dbb7cc',
54+
'info_dict': {
55+
'id': '20831',
56+
'ext': 'mp4',
57+
'description': 'Gefühle pur: Schaut euch die ungeschnittene Version von Stefans Liebesbeweis an die Moderationsgrazie von Welt, Verona Feldbusch, an.',
58+
'title': 'Raabigramm Verona Feldbusch',
59+
'thumbnail': r're:.*\.jpg',
60+
'episode_number': 6,
61+
'episode': 'Raabigramm Verona Feldbusch',
62+
'series': 'TV total',
63+
'season': 'Season 1',
64+
'season_id': '34',
65+
'duration': 105.0,
66+
'season_number': 1,
2567
},
26-
}
68+
}]
2769

2870
def _real_extract(self, url):
2971
video_id = self._match_id(url)
3072

31-
metadata = self._download_xml(
32-
'http://www.myspass.de/myspass/includes/apps/video/getvideometadataxml.php?id=' + video_id,
33-
video_id)
73+
metadata = self._download_xml('http://www.myspass.de/myspass/includes/apps/video/getvideometadataxml.php?id=' + video_id, video_id)
3474

3575
title = xpath_text(metadata, 'title', fatal=True)
3676
video_url = xpath_text(metadata, 'url_flv', 'download url', True)
3777
video_id_int = int(video_id)
38-
for group in re.search(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url).groups():
78+
for group in self._search_regex(r'/myspass2009/\d+/(\d+)/(\d+)/(\d+)/', video_url, 'myspass', group=(1, 2, 3), default=[]):
3979
group_int = int(group)
4080
if group_int > video_id_int:
41-
video_url = video_url.replace(
42-
group, compat_str(group_int // video_id_int))
81+
video_url = video_url.replace(group, compat_str(group_int // video_id_int))
4382

4483
return {
4584
'id': video_id,

0 commit comments

Comments
 (0)