Python script to download Instagram livestreams and replays.

Cammy 08b53b3144 Remove update command, improve cookie auth, try to fix login with -u, -p 7 years ago
.github cc9fec04e9 Update issue_template.md 7 years ago
pyinstalive 08b53b3144 Remove update command, improve cookie auth, try to fix login with -u, -p 7 years ago
.gitignore 059ceaf19a Clarify possible cookie error, added save_replays config entry, bugfixes 7 years ago
LICENSE 86d3a0107e Create LICENSE 7 years ago
README.md d572266cb4 Update README.md 7 years ago
setup.py fc3be4cb3c Bump version to 2.2.8 7 years ago

README.md

PyInstaLive

Version 2.2.8

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

Quickstart

  • Read the notes below.
  • 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 recording a livestream.

Installation

Prerequisites

You need ffmpeg, Git and Python 2.7.x or 3.5>= with pip and setuptools installed before you can install and use this script. Make sure all tools are accessible via command line (added to your PATH if on Windows, use Google).

Installing

Run the following command in command line (as administrator in Windows) / terminal:

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

Updating

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

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

Specific versions

If you want to install a specific version of PyInstaLive, you can specify the version tag in the install command:

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

Use the version number you want after the @ symbol (e.g 2.1.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.

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

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 record or save.

Example

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

Or (see notes)

pyinstalive -r "janedoe"

If a livestream is currently ongoing, the terminal output should be something like this:

----------------------------------------------------------------------
PYINSTALIVE (SCRIPT V1.0 - PYTHON V2.7.14) - 12:00:01 PM
----------------------------------------------------------------------
[I] Login to "johndoe" OK!
[I] Login cookie expiry date: 2018-01-01 at 12:00:01
[I] Checking user: 'justinbieber'
[I] Checking for ongoing livestreams...
[I] Starting livestream recording:
[I] Username    : justinbieber
[I] MPD URL     : https://scontent-ams3-1.cdninstagram.com/hvideo-frc1/v/rflSWUsyCsuqE-GLYgvW4/live-dash/dash-abr/17880993205152831.mpd?_nc_rl=AfCujc4yG9bJLHVn&oh=87c4fb94668286125f1169e4441056d2&oe=5A0E8951
[I] Viewers     : 2768 watching
[I] Airing time : 5 minutes and 10 seconds
[I] Status      : Active
----------------------------------------------------------------------
[I] Recording livestream... press [CTRL+C] to abort.

[I] Stitching downloaded files into video...
[I] Successfully stitched downloaded files.
----------------------------------------------------------------------

Notes

  • The username and password parameters 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

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