aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-07-13 15:03:05 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-02 01:08:16 +0530
commit1e8fe57e5cd0f33f940df87430d75e1230ec5b7a (patch)
tree206adcafb63733921d295d5b3eadf78e8f7b064d /yt_dlp/extractor
parentf14a2d838240e9e75fe52d4e381156064e90674c (diff)
downloadhypervideo-pre-1e8fe57e5cd0f33f940df87430d75e1230ec5b7a.tar.lz
hypervideo-pre-1e8fe57e5cd0f33f940df87430d75e1230ec5b7a.tar.xz
hypervideo-pre-1e8fe57e5cd0f33f940df87430d75e1230ec5b7a.zip
[extractor] Support multiple archive ids for one video (#4307)
Closes #4352
Diffstat (limited to 'yt_dlp/extractor')
-rw-r--r--yt_dlp/extractor/common.py1
-rw-r--r--yt_dlp/extractor/funimation.py3
-rw-r--r--yt_dlp/extractor/genericembeds.py3
-rw-r--r--yt_dlp/extractor/twitch.py3
4 files changed, 9 insertions, 1 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 317aa270e..c91260cb0 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -334,6 +334,7 @@ class InfoExtractor:
'private', 'premium_only', 'subscriber_only', 'needs_auth',
'unlisted' or 'public'. Use 'InfoExtractor._availability'
to set it
+ _old_archive_ids: A list of old archive ids needed for backward compatibility
__post_extractor: A function to be called just before the metadata is
written to either disk, logger or console. The function
must return a dict which will be added to the info_dict.
diff --git a/yt_dlp/extractor/funimation.py b/yt_dlp/extractor/funimation.py
index 12cacd3b4..5881f1687 100644
--- a/yt_dlp/extractor/funimation.py
+++ b/yt_dlp/extractor/funimation.py
@@ -249,7 +249,8 @@ class FunimationIE(FunimationBaseIE):
self._sort_formats(formats, ('lang', 'source'))
return {
- 'id': initial_experience_id if only_initial_experience else episode_id,
+ 'id': episode_id,
+ '_old_archive_ids': [initial_experience_id],
'display_id': display_id,
'duration': duration,
'title': episode['episodeTitle'],
diff --git a/yt_dlp/extractor/genericembeds.py b/yt_dlp/extractor/genericembeds.py
index ec2673059..f3add4794 100644
--- a/yt_dlp/extractor/genericembeds.py
+++ b/yt_dlp/extractor/genericembeds.py
@@ -22,6 +22,9 @@ class HTML5MediaEmbedIE(InfoExtractor):
entry.update({
'id': f'{video_id}-{num}',
'title': f'{title} ({num})',
+ '_old_archive_ids': [
+ f'Generic {f"{video_id}-{num}" if len(entries) > 1 else video_id}',
+ ],
})
self._sort_formats(entry['formats'])
yield entry
diff --git a/yt_dlp/extractor/twitch.py b/yt_dlp/extractor/twitch.py
index 028e7a1e8..7a798b912 100644
--- a/yt_dlp/extractor/twitch.py
+++ b/yt_dlp/extractor/twitch.py
@@ -1162,8 +1162,11 @@ class TwitchClipsIE(TwitchBaseIE):
})
thumbnails.append(thumb)
+ old_id = self._search_regex(r'%7C(\d+)(?:-\d+)?.mp4', formats[-1]['url'], 'old id', default=None)
+
return {
'id': clip.get('id') or video_id,
+ '_old_archive_ids': [f'{self.ie_key()} {old_id}'] if old_id else None,
'display_id': video_id,
'title': clip.get('title') or video_id,
'formats': formats,