[instagram] download videos from 'video_dash_manifest' data

(#6379 #7006)

requires yt-dlp / youtube-dl
This commit is contained in:
Mike Fährmann
2025-03-27 18:27:37 +01:00
parent 81a1b647bb
commit fcf76bab55
2 changed files with 32 additions and 17 deletions

View File

@@ -2997,11 +2997,19 @@ Description
extractor.instagram.videos
--------------------------
Type
``bool``
* ``bool``
* ``string``
Default
``true``
Description
Download video files.
Controls video download behavior.
``true`` | ``"dash"`` | ``"ytdl"``
Download videos from ``video_dash_manifest`` data using |ytdl|
``"merged"``
Download pre-merged video formats
``false``
Do not download videos
extractor.itaku.videos
@@ -4448,19 +4456,19 @@ Description
Possible formats include
* ``"gif"``
* ``"gif_transparent"``
* ``"gifpreview"``
* ``"mediumgif"``
* ``"tinygif"``
* ``"tinygif_transparent"``
* ``"mp4"``
* ``"tinymp4"``
* ``"webm"``
* ``"webp"``
* ``"webp_transparent"``
* ``"tinywebp"``
* ``"tinywebp_transparent"``
* ``gif``
* ``gif_transparent``
* ``mediumgif``
* ``gifpreview``
* ``tinygif``
* ``tinygif_transparent``
* ``mp4``
* ``tinymp4``
* ``webm``
* ``webp``
* ``webp_transparent``
* ``tinywebp``
* ``tinywebp_transparent``
extractor.tiktok.audio

View File

@@ -56,9 +56,11 @@ class InstagramExtractor(Extractor):
data = self.metadata()
videos = self.config("videos", True)
if videos:
videos_dash = (videos != "merged")
videos_headers = {"User-Agent": "Mozilla/5.0"}
previews = self.config("previews", False)
max_posts = self.config("max-posts")
video_headers = {"User-Agent": "Mozilla/5.0"}
order = self.config("order-files")
reverse = order[0] in ("r", "d") if order else False
@@ -92,8 +94,12 @@ class InstagramExtractor(Extractor):
url = file.get("video_url")
if url:
if videos:
file["_http_headers"] = video_headers
file["_http_headers"] = videos_headers
text.nameext_from_url(url, file)
if videos_dash:
file["_fallback"] = (url,)
file["_ytdl_manifest"] = "dash"
url = "ytdl:dash"
yield Message.Url, url, file
if previews:
file["media_id"] += "p"
@@ -246,6 +252,7 @@ class InstagramExtractor(Extractor):
"video_url" : video["url"] if video else None,
"width" : media["width"],
"height" : media["height"],
"_ytdl_manifest_data": item.get("video_dash_manifest"),
}
if "expiring_at" in item: