aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/ndr.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/extractor/ndr.py')
-rw-r--r--youtube_dl/extractor/ndr.py31
1 files changed, 9 insertions, 22 deletions
diff --git a/youtube_dl/extractor/ndr.py b/youtube_dl/extractor/ndr.py
index 2447c812e..aec2ea133 100644
--- a/youtube_dl/extractor/ndr.py
+++ b/youtube_dl/extractor/ndr.py
@@ -7,11 +7,8 @@ from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
- merge_dicts,
parse_iso8601,
qualities,
- try_get,
- urljoin,
)
@@ -88,25 +85,21 @@ class NDRIE(NDRBaseIE):
def _extract_embed(self, webpage, display_id):
embed_url = self._html_search_meta(
- 'embedURL', webpage, 'embed URL',
- default=None) or self._search_regex(
- r'\bembedUrl["\']\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
- 'embed URL', group='url')
+ 'embedURL', webpage, 'embed URL', fatal=True)
description = self._search_regex(
r'<p[^>]+itemprop="description">([^<]+)</p>',
webpage, 'description', default=None) or self._og_search_description(webpage)
timestamp = parse_iso8601(
self._search_regex(
r'<span[^>]+itemprop="(?:datePublished|uploadDate)"[^>]+content="([^"]+)"',
- webpage, 'upload date', default=None))
- info = self._search_json_ld(webpage, display_id, default={})
- return merge_dicts({
+ webpage, 'upload date', fatal=False))
+ return {
'_type': 'url_transparent',
'url': embed_url,
'display_id': display_id,
'description': description,
'timestamp': timestamp,
- }, info)
+ }
class NJoyIE(NDRBaseIE):
@@ -227,17 +220,11 @@ class NDREmbedBaseIE(InfoExtractor):
upload_date = ppjson.get('config', {}).get('publicationDate')
duration = int_or_none(config.get('duration'))
- thumbnails = []
- poster = try_get(config, lambda x: x['poster'], dict) or {}
- for thumbnail_id, thumbnail in poster.items():
- thumbnail_url = urljoin(url, thumbnail.get('src'))
- if not thumbnail_url:
- continue
- thumbnails.append({
- 'id': thumbnail.get('quality') or thumbnail_id,
- 'url': thumbnail_url,
- 'preference': quality_key(thumbnail.get('quality')),
- })
+ thumbnails = [{
+ 'id': thumbnail.get('quality') or thumbnail_id,
+ 'url': thumbnail['src'],
+ 'preference': quality_key(thumbnail.get('quality')),
+ } for thumbnail_id, thumbnail in config.get('poster', {}).items() if thumbnail.get('src')]
return {
'id': video_id,