youtube-dl 库是否支持从 instagram 下载故事?

我使用名为 YouTube-dl 的库,可以从许多站点下载。

它支持 cookie 文件。我做了以下代码:

youtube-dl -j —-cookies /path/to/cookies.txt URLgoesHere

我想要的是如何使用这个库从 Instagram 下载故事?在命令行上。

stack overflow Does youtube-dl library support download stories from instagram?
原文答案

答案:

作者头像

更新: 对于 video 幻灯片的 Instagram 故事,请使用 yt-dlp (需要 v2022.1.21):

pip install 'yt-dlp>=2022.1.21'

只需确保您已通过其中一种身份验证方法登录:

  • --cookies-from-browser YOUR_BROWSER
  • --cookies /path/to/cookies.txt
  • -u YOUR_USERNAME (交互式)
  • -n ( config file )

    
    yt-dlp --cookies-from-browser firefox https://www.instagram.com/stories/highlights/17863022906349328/

[cookies] Extracting cookies from firefox

[cookies] Extracted 2051 cookies from firefox

[instagram:story] 17863022906349328: Downloading JSON metadata

[instagram:story] 17863022906349328: Downloading JSON metadata

[instagram:story] 17863022906349328: Downloading user info

[download] Downloading playlist: Mars AR

[instagram:story] playlist Mars AR: Collected 7 videos; downloading 7 of them

[download] Downloading video 1 of 7

[info] 2515578473642074643_787132: Downloading 1 format(s): 2

[download] Destination: Story by natgeo [2515578473642074643_787132].mp4

[download] 100% of 793.91KiB in 00:00

[download] Finished downloading playlist: Mars AR


对于 **image** 幻灯片的 Instagram 故事,请使用  [gallery-dl](https://github.com/mikf/gallery-dl) :

pip install gallery-dl

gallery-dl -u USERNAME -p PASSWORD https://www.instagram.com/stories/highlights/17857710373716419/

[instagram][info] Logging in as USERNAME

./gallery-dl/instagram/weighthefish/2224872001634244851.jpg

./gallery-dl/instagram/weighthefish/2224872078683640644.jpg

...

./gallery-dl/instagram/weighthefish/2224872839329073284.jpg



* * *

请注意  [yt-dlp](https://github.com/yt-dlp/yt-dlp)  是  [youtube-dl](https://github.com/yt-dlp/youtube-dl)  的一个分支(我不隶属于任何一个):

>  [yt-dlp](https://github.com/yt-dlp/yt-dlp)  是基于现在非活动  [youtube-dl](https://github.com/yt-dlp/youtube-dl)  的  [youtube-dlc](https://github.com/blackjack4494/yt-dlc)  分支。该项目的主要重点是添加  [new features](https://github.com/yt-dlp/yt-dlp#new-features)  和补丁,同时与原始项目保持同步。

 [youtube-dl](https://github.com/yt-dlp/youtube-dl)  仍然不支持 Instagram 快拍,尽管它是  [tagged as "todo" on their issue tracker](https://github.com/ytdl-org/youtube-dl/issues/25575) 。
作者头像

它现在可以非常优雅地检查版本:2021.04.17

youtube-dl https://www.instagram.com/p/<story_link>/