Skip to content

Commit 36abc16

Browse files
adrianheinedstftw
authored andcommitted
[apa] Fix extraction
1 parent 919d764 commit 36abc16

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

youtube_dl/extractor/apa.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from ..utils import (
88
determine_ext,
99
js_to_json,
10-
url_or_none,
1110
)
1211

1312

@@ -17,14 +16,10 @@ class APAIE(InfoExtractor):
1716
'url': 'http://uvp.apa.at/embed/293f6d17-692a-44e3-9fd5-7b178f3a1029',
1817
'md5': '2b12292faeb0a7d930c778c7a5b4759b',
1918
'info_dict': {
20-
'id': 'jjv85FdZ',
19+
'id': '293f6d17-692a-44e3-9fd5-7b178f3a1029',
2120
'ext': 'mp4',
22-
'title': '"Blau ist mysteriös": Die Blue Man Group im Interview',
23-
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
21+
'title': '293f6d17-692a-44e3-9fd5-7b178f3a1029',
2422
'thumbnail': r're:^https?://.*\.jpg$',
25-
'duration': 254,
26-
'timestamp': 1519211149,
27-
'upload_date': '20180221',
2823
},
2924
}, {
3025
'url': 'https://uvp-apapublisher.sf.apa.at/embed/2f94e9e6-d945-4db2-9548-f9a41ebf7b78',
@@ -48,7 +43,7 @@ def _extract_urls(webpage):
4843
def _real_extract(self, url):
4944
video_id = self._match_id(url)
5045

51-
webpage = self._download_webpage(url, video_id)
46+
webpage = self._download_webpage('https://uvp.apa.at/player/%s' % video_id, video_id)
5247

5348
jwplatform_id = self._search_regex(
5449
r'media[iI]d\s*:\s*["\'](?P<id>[a-zA-Z0-9]{8})', webpage,
@@ -59,18 +54,12 @@ def _real_extract(self, url):
5954
'jwplatform:' + jwplatform_id, ie='JWPlatform',
6055
video_id=video_id)
6156

62-
sources = self._parse_json(
63-
self._search_regex(
64-
r'sources\s*=\s*(\[.+?\])\s*;', webpage, 'sources'),
65-
video_id, transform_source=js_to_json)
57+
sources = self._parse_json("{" + self._search_regex(
58+
r'("hls"\s*:\s*"[^"]+"\s*,\s*"progressive"\s*:\s*"[^"]+")', webpage, 'sources')
59+
+ "}", video_id, transform_source=js_to_json)
6660

6761
formats = []
68-
for source in sources:
69-
if not isinstance(source, dict):
70-
continue
71-
source_url = url_or_none(source.get('file'))
72-
if not source_url:
73-
continue
62+
for (format, source_url) in sources.items():
7463
ext = determine_ext(source_url)
7564
if ext == 'm3u8':
7665
formats.extend(self._extract_m3u8_formats(
@@ -83,7 +72,7 @@ def _real_extract(self, url):
8372
self._sort_formats(formats)
8473

8574
thumbnail = self._search_regex(
86-
r'image\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
75+
r'"poster"\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
8776
'thumbnail', fatal=False, group='url')
8877

8978
return {

0 commit comments

Comments
 (0)