D I*_* R 6 python shell command-line instagram youtube-dl
我使用名为 YouTube-dl 的库,可以从许多网站下载。
\n它支持cookies文件。我编写了以下代码:
\nyoutube-dl -j \xe2\x80\x94-cookies /path/to/cookies.txt URLgoesHere\n
Run Code Online (Sandbox Code Playgroud)\n我想要的是如何使用这个库从 Instagram 下载故事?在命令行上。
\ntdy*_*tdy 18
更新:对于视频幻灯片的 Instagram 故事,请使用yt-dlp(需要 v2022.1.21):
\npip install \'yt-dlp>=2022.1.21\'\n
Run Code Online (Sandbox Code Playgroud)\n只需确保您已通过其中一种身份验证方法登录:
\n--cookies-from-browser YOUR_BROWSER
--cookies /path/to/cookies.txt
-u YOUR_USERNAME
(交互的)-n
(配置文件)yt-dlp --cookies-from-browser firefox https://www.instagram.com/stories/highlights/17863022906349328/\n\n# [cookies] Extracting cookies from firefox\n# [cookies] Extracted 2051 cookies from firefox\n# [instagram:story] 17863022906349328: Downloading JSON metadata\n# [instagram:story] 17863022906349328: Downloading JSON metadata\n# [instagram:story] 17863022906349328: Downloading user info\n# [download] Downloading playlist: Mars AR\n# [instagram:story] playlist Mars AR: Collected 7 videos; downloading 7 of them\n# [download] Downloading video 1 of 7\n# [info] 2515578473642074643_787132: Downloading 1 format(s): 2\n# [download] Destination: Story by natgeo [2515578473642074643_787132].mp4\n# [download] 100% of 793.91KiB in 00:00\n# \xe2\x8b\xae\n# [download] Finished downloading playlist: Mars AR\n
Run Code Online (Sandbox Code Playgroud)\n对于图像幻灯片的 Instagram 故事,请使用gallery-dl:
\npip install gallery-dl\n
Run Code Online (Sandbox Code Playgroud)\ngallery-dl -u USERNAME -p PASSWORD https://www.instagram.com/stories/highlights/17857710373716419/\n\n# [instagram][info] Logging in as USERNAME\n# ./gallery-dl/instagram/weighthefish/2224872001634244851.jpg\n# ./gallery-dl/instagram/weighthefish/2224872078683640644.jpg\n# ...\n# ./gallery-dl/instagram/weighthefish/2224872839329073284.jpg\n
Run Code Online (Sandbox Code Playgroud)\n请注意,yt-dlp是youtube-dl的一个分支(我不隶属于任何一个):
\n\n\nyt-dlp是基于现在不活动的youtube-dlc 的youtube-dl分支。该项目的主要重点是添加新功能和补丁,同时保持原始项目的最新状态。
\n
youtube-dl仍然不支持 Instagram 故事,尽管它在问题跟踪器上被标记为“todo”。
\n