Python script to download Instagram livestreams and replays.

Cammy 5907fc8664 Adjust spacer height 7 tahun lalu
.github 5907fc8664 Adjust spacer height 7 tahun lalu
pyinstalive e1d7053809 Bump version to 2.5.3 7 tahun lalu
.gitignore 1506e4aed8 Ignore .spec 7 tahun lalu
FAQ.md cfb0a2402c Update FAQ.md 7 tahun lalu
LICENSE 86d3a0107e Create LICENSE 7 tahun lalu
MOREHELP.md 97829c2361 Bump version to 2.5.2 7 tahun lalu
README.md 53a5838422 Update README.md 7 tahun lalu
pyinstalive.ico be6bda5825 Add icon 7 tahun lalu
pyinstalive_win.py 236a25a159 Add py file used to build win64 binaries 7 tahun lalu
setup.py e1d7053809 Bump version to 2.5.3 7 tahun lalu

README.md

PyInstaLive

Version 2.5.3

This script enables you to download any ongoing Instagram livestreams as well as any available replays. It is based on another script that has now been discontinued.

Table of Contents

Features

  • Download ongoing livestreams (also detects livestreams in which the user is live with the livestream owner)
  • Download available replays
  • Download livestream and replay comments
  • Run a command when starting and/or finishing a download (Experimental)

Quickstart

  • Read the Notes & Help sections below (important!)
  • Install the prerequisites and then PyInstaLive.
  • Run pyinstalive -c to generate a configuration file.
  • Edit the configuration file using any text editor.
  • Run pyinstalive -r "<live-username>" to start downloading a livestream or replay.

Note for Windows users using the executable

The Windows builds have not been fully tested and may not work for you but feel free to try it out and report any errors you may encounter.

This is a CLI application and as such must be run from the command line. There is no available user interface.

If using Windows 7, 8 or 8.1 make sure you have installed the update for Universal C Runtime in Windows. Windows 10 users already have this update installed by default.

Installation

Prerequisites

Windows
Linux (and Windows if not using the executable)

Make sure all tools are accessible via command line (added to your PATH if on Windows, use Google).

Installing

If you run Windows you can also try out the Windows build available here. In case it doesn't work or you just prefer building PyInstaLive from source follow the instructions below.

Tip — If you use the Windows executable you can add that to your PATH as well. The easiest way is by copying it to the Windows installation folder.

Run the following command in Command Prompt (might need to be run as administrator on Windows) or a terminal:

pip install git+https://github.com/notcammy/PyInstaLive.git@2.5.3 --process-dependency-links

Updating

To update PyInstaLive to the latest version (currently 2.5.3) run the following command:

pip install git+https://github.com/notcammy/PyInstaLive.git@2.5.3 --process-dependency-links --upgrade

Specific versions

If you want to install a specific version of PyInstaLive when for example the newest version contains a bug, you can specify the version tag in the install command:

pip install git+https://github.com/notcammy/PyInstaLive.git@2.2.0 --process-dependency-links

Use the version number you want after the @ symbol (e.g 2.2.0).

Usage

Make sure there is a configuration file called pyinstalive.ini in the directory you want to run PyInstaLive from.

You can run pyinstalive -c to automatically generate a default configuration file if one is not present.

For more information about the configuration file go here.

Here is an example of a valid configuration file:

[pyinstalive]
username = johndoe
password = grapefruits
save_path = 
show_cookie_expiry = true
clear_temp_files = false
save_replays = true
run_at_start =
run_at_finish =
save_comments = false
log_to_file = false

Use the following command to run PyInstaLive:

pyinstalive -u "<username>" -p "<password>" -r "<live-username>"

Where <username> is your account's username, <password> is your password and <live-username> is the username of the user whose livestream or replay you want to download.

Example

pyinstalive -u "johndoe" -p "grapefruits" -r "janedoe"

Or (see notes)

pyinstalive -r "janedoe"

Below is an example of PyInstaLive's output after downloading a livestream:

----------------------------------------------------------------------
PYINSTALIVE (SCRIPT V2.5.3 - PYTHON V3.6.3) - 06:45:30 PM
----------------------------------------------------------------------
[I] Using cached login cookie for "johndoe".
[I] Login cookie expiry date: 2018-01-31 at 10:30:00 PM
[I] Getting info for "janedoe" successful.
----------------------------------------------------------------------
[I] Checking for livestreams and replays...
----------------------------------------------------------------------
[I] Livestream found, beginning download...
----------------------------------------------------------------------
[I] Username    : janedoe
[I] Viewers     : 100 watching
[I] Airing time : 2 minutes And 10 seconds
[I] Status      : Active
[I] MPD URL     : https://scontent-amt2-1.cdninstagram.com/hvideo-prn1/v/rID1yGvO_UPlsukIhbhOx/live-dash/dash-hd/17907800311113848.mpd?_nc_rl=AfBVd51QpQOj_ImC&oh=aa8d53b4fd736c0edc29c97b411bd32b&oe=5A6FDE8B
----------------------------------------------------------------------
[I] Downloading livestream... press [CTRL+C] to abort.
----------------------------------------------------------------------
[I] The livestream has ended.
[I] Time recorded     : 13 minutes and 10 seconds
[I] Stream duration   : 15 minutes and 20 seconds
[I] Missing (approx.) : 2 minutes and 10 seconds
----------------------------------------------------------------------
[I] Stopping comment downloading and saving comments (if any)...
[I] Successfully saved 550 comments to logfile.
----------------------------------------------------------------------
[I] Stitching downloaded files into video...
[I] Successfully stitched downloaded files into video.
----------------------------------------------------------------------

Notes

  • Python 2 cannot save most unicode characters in comments such as emojis if it's not built from source using the --enable-unicode=ucs4 flag. Read more about this here. This should probably not affect pre-installed Python 2 installations on Linux-based systems such as Ubuntu or Debian.

  • The username and password arguments are not required when you have specified these in the configuration file.

  • This script is also reported to work on Python 3.4.x but is not officially supported.

  • If the script is ran and there are available replays as well as an ongoing Instagram livestream, only the livestream will be downloaded. Run the script again after the livestream has ended to download the available replays.

Help

You can find a list of frequently asked questions here.

You can find a list of available commands and an explanation of the configuration file here.

If you would like to report a bug or ask a question please open an issue.