Downloading Video From Instagram

From Littledamien Wiki
Jump to navigation Jump to search

Online video download services[edit]

  • savefrom.net
    Requires a VPN. Doesn't work in the US. But it does successfully download IG videos with audio elsewhere.

Command line[edit]

Instaloader[edit]

Instaloader is a command line utility for downloading images and video. I don't think I have tried it for downloading video with audio.

It can be installed with

$ pip3 install instaloader

Which installs it wherever python is installed, i.e. not somewhere included in PATH. So either include the python bin directory in path, or run instaloader using its full path, e.g. /Users/[me]/Library/Python/3.9/bin/instaloader.

To download all the image associated with an Instagram post:

$ instaloader -- -[POST_ID]

This will create a folder in the current directory named "-[POST_ID]". The dash in the filename screws with using it as a command line argument. Using a relative path to access it works, e.g. cd ./-[POST_ID]

Instaloader downloads are limited to 1080 pixels when a user is not logged in. In order to download the largest possible images:

$ instaloader --login=[INSTAGRAM_USERNAME] -- -[POST_ID]

Download via browser[edit]

This wasn't working for me for at least one video in January 2024.
  • Load the video on its own page, not within a feed.
  • Right click on the video, then click Inspect to open Chrome Developer Tools.
  • Select the Network tab.
  • Search (Cmd + F) for "mp4" or "m3u8" to locate video sources on the page.
    • Click on one of the results.
    • This should cause content to be loaded in the Preview subtab, still under Network.
    • Click on the Headers subtab (same level as the Response tab.)
    • This should display a Request URL under the General section.
    • Copy the Request URL link.
  • Paste that request URL into a new browser tab.
    • Remove the bytestart and byteend parameters from the URL.
    • Now hit enter to process that request without those two parameters in the URL.
    • The video should be displayed but it won't have audio. Apparently Facebook delivers video and audio separately.
    • Right click on the video and select Download.

TODO[edit]

Figure out how to download the audio file and stitch it back together with the video using either VLC or ffmpeg.

Reference[edit]