Compare commits

..

3 Commits

Author SHA1 Message Date
Bart Broere
6de650f51f Use traverse_obj in another place as well 2024-09-21 20:08:53 +00:00
Bart Broere
bf91db4846 Use suggested util 2024-09-21 20:04:50 +00:00
Bart Broere
ad6ee6fdd2
Commit two suggestions from the PR
Co-authored-by: dirkf <fieldhouse@gmx.net>
2024-09-21 21:58:53 +02:00

View File

@ -5,7 +5,7 @@ import json
import re
from .common import InfoExtractor
from ..utils import ExtractorError
from ..utils import ExtractorError, join_nonempty, traverse_obj
class NPOIE(InfoExtractor):
@ -95,7 +95,7 @@ class NPOIE(InfoExtractor):
},
fatal=False,
)
stream_url = stream_link.get('stream', {}).get('streamURL')
stream_url = traverse_obj(stream_link, ('stream', 'streamURL'))
formats.extend(self._extract_mpd_formats(stream_url, slug, mpd_id='dash', fatal=False))
return formats
@ -140,9 +140,9 @@ class BNNVaraIE(NPOIE):
return {
'id': product_id,
'title': media.get('data', {}).get('player', {}).get('title'),
'title': traverse_obj(media, ('data', 'player', 'title')),
'formats': formats,
'thumbnail': media.get('data', {}).get('player', {}).get('image').get('url'),
'thumbnail': traverse_obj(media, ('data', 'player', 'image', 'url')),
}
@ -160,7 +160,7 @@ class ONIE(NPOIE):
def _real_extract(self, url):
video_id = url.rstrip('/').split('/')[-1]
page, _ = self._download_webpage_handle(url, video_id)
page = self._download_webpage(url, video_id)
results = re.findall("page: '(.+)'", page)
formats = []
for result in results:
@ -241,7 +241,7 @@ class SchoolTVIE(NPOIE):
return {
'id': video_id,
'title': metadata.get('title', '') + ' - ' + metadata.get('subtitle', ''),
'title': join_nonempty('title', 'subtitle', from_dict=metadata),
'description': metadata.get('description') or metadata.get('short_description'),
'formats': formats,
}