aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRedDeffender <74822209+RedDeffender@users.noreply.github.com>2023-08-31 01:26:45 +0200
committerGitHub <noreply@github.com>2023-08-30 23:26:45 +0000
commitbae4834245a708fff97219849ec880c319c88bc6 (patch)
tree346b7b9e2b3b943a844a137f747de8cccd184756
parent099fb1b35cf835303306549f5113d1802d79c9c7 (diff)
downloadhypervideo-pre-bae4834245a708fff97219849ec880c319c88bc6.tar.lz
hypervideo-pre-bae4834245a708fff97219849ec880c319c88bc6.tar.xz
hypervideo-pre-bae4834245a708fff97219849ec880c319c88bc6.zip
[ie/NoodleMagazine] Fix extraction (#7830)
Closes #7917 Authored by: RedDeffender
-rw-r--r--yt_dlp/extractor/noodlemagazine.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/yt_dlp/extractor/noodlemagazine.py b/yt_dlp/extractor/noodlemagazine.py
index e6208956f..1cea0dbda 100644
--- a/yt_dlp/extractor/noodlemagazine.py
+++ b/yt_dlp/extractor/noodlemagazine.py
@@ -1,9 +1,14 @@
from .common import InfoExtractor
from ..utils import (
- parse_duration,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
parse_count,
- unified_strdate
+ parse_duration,
+ unified_strdate,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NoodleMagazineIE(InfoExtractor):
@@ -37,15 +42,21 @@ class NoodleMagazineIE(InfoExtractor):
like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
- key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
- playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m={key}', video_id)
- thumbnail = self._og_search_property('image', webpage, default=None) or playlist_info.get('image')
+ player_path = extract_attributes(get_element_html_by_id('iplayer', webpage) or '')['src']
+ player_iframe = self._download_webpage(
+ urljoin('https://adult.noodlemagazine.com', player_path), video_id, 'Downloading iframe page')
+ playlist_url = self._search_regex(
+ r'window\.playlistUrl\s*=\s*["\']([^"\']+)["\']', player_iframe, 'playlist url')
+ playlist_info = self._download_json(
+ urljoin('https://adult.noodlemagazine.com', playlist_url), video_id, headers={'Referer': url})
- formats = [{
- 'url': source.get('file'),
- 'quality': source.get('label'),
- 'ext': source.get('type'),
- } for source in playlist_info.get('sources')]
+ thumbnail = self._og_search_property('image', webpage, default=None) or playlist_info.get('image')
+ formats = traverse_obj(playlist_info, ('sources', lambda _, v: v['file'], {
+ 'url': 'file',
+ 'format_id': 'label',
+ 'height': ('label', {int_or_none}),
+ 'ext': 'type',
+ }))
return {
'id': video_id,