mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-22 02:34:39 +00:00
Compare commits
2 Commits
415b4c9f95
...
e0d6c08229
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0d6c08229 | ||
|
|
53ea743a9c |
@ -341,7 +341,7 @@ class PatreonIE(PatreonBaseIE):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
# all-lowercase 'referer' so we can smuggle it to Generic, SproutVideo, Vimeo
|
# all-lowercase 'referer' so we can smuggle it to Generic, SproutVideo, Vimeo
|
||||||
headers = {'referer': 'https://patreon.com/'}
|
headers = {'referer': url}
|
||||||
|
|
||||||
# handle Vimeo embeds
|
# handle Vimeo embeds
|
||||||
if traverse_obj(attributes, ('embed', 'provider')) == 'Vimeo':
|
if traverse_obj(attributes, ('embed', 'provider')) == 'Vimeo':
|
||||||
@ -379,11 +379,13 @@ class PatreonIE(PatreonBaseIE):
|
|||||||
'url': post_file['url'],
|
'url': post_file['url'],
|
||||||
})
|
})
|
||||||
elif name == 'video' or determine_ext(post_file.get('url')) == 'm3u8':
|
elif name == 'video' or determine_ext(post_file.get('url')) == 'm3u8':
|
||||||
formats, subtitles = self._extract_m3u8_formats_and_subtitles(post_file['url'], video_id)
|
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
||||||
|
post_file['url'], video_id, headers=headers)
|
||||||
entries.append({
|
entries.append({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
|
'http_headers': headers,
|
||||||
})
|
})
|
||||||
|
|
||||||
can_view_post = traverse_obj(attributes, 'current_user_can_view')
|
can_view_post = traverse_obj(attributes, 'current_user_can_view')
|
||||||
|
|||||||
@ -3950,19 +3950,23 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
skipped_subs_clients = set()
|
skipped_subs_clients = set()
|
||||||
prs = traverse_obj(player_responses, (
|
|
||||||
# Filter out initial_pr which does not have streamingData (smuggled client context)
|
|
||||||
lambda _, v: v['streamingData'] and v['captions']['playerCaptionsTracklistRenderer']))
|
|
||||||
|
|
||||||
pctrs = traverse_obj(prs, (..., 'captions', 'playerCaptionsTracklistRenderer', {dict}))
|
# Only web/mweb clients provide translationLanguages, so include initial_pr in the traversal
|
||||||
translation_languages = {
|
translation_languages = {
|
||||||
lang.get('languageCode'): self._get_text(lang.get('languageName'), max_runs=1)
|
lang['languageCode']: self._get_text(lang['languageName'], max_runs=1)
|
||||||
for lang in traverse_obj(pctrs, (..., 'translationLanguages', ..., {dict}))}
|
for lang in traverse_obj(player_responses, (
|
||||||
|
..., 'captions', 'playerCaptionsTracklistRenderer', 'translationLanguages',
|
||||||
|
lambda _, v: v['languageCode'] and v['languageName']))
|
||||||
|
}
|
||||||
# NB: Constructing the full subtitle dictionary is slow
|
# NB: Constructing the full subtitle dictionary is slow
|
||||||
get_translated_subs = 'translated_subs' not in self._configuration_arg('skip') and (
|
get_translated_subs = 'translated_subs' not in self._configuration_arg('skip') and (
|
||||||
self.get_param('writeautomaticsub', False) or self.get_param('listsubtitles'))
|
self.get_param('writeautomaticsub', False) or self.get_param('listsubtitles'))
|
||||||
|
|
||||||
all_captions = traverse_obj(pctrs, (..., 'captionTracks', ..., {dict}))
|
# Filter out initial_pr which does not have streamingData (smuggled client context)
|
||||||
|
prs = traverse_obj(player_responses, (
|
||||||
|
lambda _, v: v['streamingData'] and v['captions']['playerCaptionsTracklistRenderer']))
|
||||||
|
all_captions = traverse_obj(prs, (
|
||||||
|
..., 'captions', 'playerCaptionsTracklistRenderer', 'captionTracks', ..., {dict}))
|
||||||
need_subs_langs = {get_lang_code(sub) for sub in all_captions if sub.get('kind') != 'asr'}
|
need_subs_langs = {get_lang_code(sub) for sub in all_captions if sub.get('kind') != 'asr'}
|
||||||
need_caps_langs = {
|
need_caps_langs = {
|
||||||
remove_start(get_lang_code(sub), 'a-')
|
remove_start(get_lang_code(sub), 'a-')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user