Skip to content

Commit 69bfe2c

Browse files
committed
Rename variables, update markdowns, fix bad quality dash stream
1 parent 513bd14 commit 69bfe2c

13 files changed

+147
-168
lines changed

.github/issue_template.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#### Check the boxes below by filling `[ ]` with an `x` so it looks like `[x]`.
33
#### Use the Preview button to ensure the template is filled in correctly.
44
##
5-
- [ ] I am using the latest version of PyInstaLive: 3.2.4.
6-
- [ ] I have installed either Python 2.7.x or 3.5+: `YOUR VERSION HERE`
5+
- [ ] I am using the latest version of PyInstaLive: 3.3.0.
6+
- [ ] I have installed 3.6+: `YOUR VERSION HERE`
77
- [ ] I have read the [README](https://github.com/notcammy/pyinstalive/blob/master/README.md).
88
- [ ] I have read the [FAQ](https://github.com/notcammy/pyinstalive/blob/master/FAQ.md).
99
- [ ] I have checked all [existing issues](https://github.com/notcammy/PyInstaLive/issues?q=is%3Aissue), none of which could solve my issue.
@@ -34,33 +34,32 @@ Run ```pyinstalive --info``` and paste its output below. Don't forget to omit yo
3434
```bash
3535
$ pyinstalive --info
3636
---------------------------------------------------------------------------
37-
[I] PYINSTALIVE (SCRIPT V3.2.4 - PYTHON V3.6.3) - 01-02-2019 07:00:17 PM
37+
[I] PYINSTALIVE (SCRIPT V3.3.0 - PYTHON V3.8.10) - 08-21-2021 03:33:23 AM
3838
---------------------------------------------------------------------------
3939
[I] To see all the available arguments, use the -h argument.
4040

41-
[I] PyInstaLive version: 3.2.4
42-
[I] Python version: 3.6.3
41+
[I] PyInstaLive version: 3.3.0
42+
[I] Python version: 3.8.10
4343
[I] FFmpeg framework: Available
44-
[I] Cookie files: 2 (johndoe.json matches config user)
44+
[I] Login session files: 1 (johndoe.dat matches config user)
4545
[I] CLI supports color: Yes
4646
[I] Command to run at start: None
4747
[I] Command to run at finish: None
4848
[I] Config file contents:
4949

5050
[pyinstalive]
51-
username = *removed*
52-
password = *removed*
51+
username = johndoe
52+
password = grapefruits
5353
download_path = \path\to\downloads
54-
download_lives = True
55-
download_replays = True
54+
show_session_expires = True
5655
download_comments = True
57-
show_cookie_expiry = False
58-
ffmpeg_path =
59-
log_to_file = True
60-
run_at_start =
61-
run_at_finish =
62-
use_locks = True
6356
clear_temp_files = False
57+
skip_assemble = False
58+
cmd_on_started =
59+
cmd_on_ended =
60+
ffmpeg_path =
61+
log_to_file = True
62+
use_locks = False
6463

6564
[I] End of PyInstaLive information screen.
6665
---------------------------------------------------------------------------
@@ -71,7 +70,7 @@ Paste the command here that you are running. Don't forget to omit your **usernam
7170

7271
**Example:** ```pyinstalive -u "johndoe" -p "grapefruits" -d "justinbieber"```
7372

74-
###### Behavior
73+
###### Behaviour
7574
Accurately describe the issue you're experiencing with the script.
7675

7776
###### Steps to reproduce issue

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@ venv/
6969

7070

7171
*_downloads\
72+
73+
*.txt

FAQ.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This means you are making too many requests to Instagram and is usually the case
1616

1717
#### Option 1 - Checking your following users
1818

19-
You can use the `--download-following` function to check for available livestreams and replays from your following user list. Read the [Help Documents](https://github.com/notcammy/PyInstaLive/blob/master/MOREHELP.md) for more information.
19+
You can use the `--download-following` function to check for available livestreams from your following user list. Read the [Help Documents](https://github.com/notcammy/PyInstaLive/blob/master/MOREHELP.md) for more information.
2020

2121
#### Option 2 - Using external scripts
2222
##### Note: Continuously checking for livestreams with an external script is considered suspicious behaviour by Instagram. Use a timeout as large as possible to decrease the chances of your account, device or IP from getting flagged as suspicious and getting blocked as a result of that. Use the scripts below at your own risk.
@@ -57,20 +57,13 @@ Use the scripts provided in the previous question, they'll infinitely run the Py
5757

5858
No. This is because livestream_dl is no longer being maintained and as such uses an older version of libraries required by PyInstaLive. Installing PyInstaLive and livestream_dl on different Python versions (2/3) will probably work though.
5959

60-
### PyInstaLive failed to generate a video file after the download has ended. What do I do?
60+
### PyInstaLive failed to assemble a video file after the download has ended. What do I do?
6161

62-
Don't get your hopes up because manually generating a video file has no guarantee of success, but read below for instructions on what you can do in case this has happened to you.
63-
64-
If it failed to generate a video file from a **livestream** you have two options:
62+
If it failed to assemble a video there are two options:
6563
* Use the `--assemble` command as described in the [FAQ](https://github.com/notcammy/PyInstaLive/blob/master/MOREHELP.md#commands).
6664

6765
If that didn't work, you can still attempt to concatenate the segment files yourself:
6866

6967
* Open the segment video directory in your command line.
7068
* Windows: `copy /b *.m4v video.mp4 && copy /b *.m4a audio.mp4 && ffmpeg -i video.mp4 -i audio.mp4 -c copy output.mp4`
71-
* Linux: `cat *.m4v > video.mp4 && cat *.m4a > audio.mp4 && ffmpeg -i video.mp4 -i audio.mp4 -c copy output.mp4`
72-
73-
##
74-
75-
If it failed to generate a video file from a **replay** you can try the following:
76-
- Open the segment video directory in your command line and run `ffmpeg -i video.mp4 -i audio.mp4 -c copy output.mp4`.
69+
* Linux: `cat *.m4v > video.mp4 && cat *.m4a > audio.mp4 && ffmpeg -i video.mp4 -i audio.mp4 -c copy output.mp4`

MOREHELP.md

+14-25
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
- ```-cl``` or ```--clean``` **** PyInstaLive clean the current download folder by deleting folders ending in `_downloads`. Any folders that contain a `folder.lock` file (e.g. folders for ongoing downloads) will be skipped.
1515

16-
- ```-df``` or ```--download-following``` **** PyInstaLive will check if any users from your following list have any available livestreams or replays and start a daemon process running PyInstaLive in the background for those that do. You cannot cancel the launched processes or start them with any extra arguments. It's recommended to enable ```log_to_file``` when using this argument. (Experimental, use at own risk.)
16+
- ```-df``` or ```--download-following``` **** PyInstaLive will check if any users from your following list have any available livestreams and start a daemon process running PyInstaLive in the background for those that do. You cannot cancel the launched processes or start them with any extra arguments. It's recommended to enable ```log_to_file``` when using this argument. (Experimental, use at own risk.)
1717

1818
- ```-cp``` or ```--config-path``` **** Passing this argument along with a valid path to a different configuration file will override the default path used by PyInstaLive (the current directory you are executing the script in).
1919

@@ -23,7 +23,7 @@
2323

2424
- ```-b``` or ```--batch-file``` **** PyInstaLive will check the users inside a text file for any available livestreams or replays.
2525

26-
- ```-o``` or ```--organize``` **** (**In testing, use at your own discretion**) Passing this argument will create a folder for each user whose livestream(s) you have downloaded. The names of the folders will be their usernames. It will then move the video and log files of each user into their associated folder and rename the files to a more friendly format. Example filename: ```19-04-2020 06-02-10-PM johndoe (replay).mp4```. Temporary file segment folders will not be moved.
26+
- ```-o``` or ```--organize``` **** (**In testing, use at your own discretion**) Passing this argument will create a folder for each user whose livestream(s) you have downloaded. The names of the folders will be their usernames. It will then move the video and log files of each user into their associated folder and rename the files to a more friendly format. Example filename: ```19-04-2020 06-02-10-PM johndoe.mp4```. Temporary file segment folders will not be moved.
2727

2828
- ```-sm``` or ```--skip-assemble``` **** PyInstaLive will not assemble any download livestream files when this argument is used.
2929

@@ -35,46 +35,35 @@
3535
username = johndoe
3636
password = grapefruits
3737
download_path =
38-
show_cookie_expiry = True
39-
log_to_file = True
40-
ffmpeg_path =
41-
run_at_start =
42-
run_at_finish =
43-
use_locks = True
38+
show_session_expires = True
39+
download_comments = True
4440
clear_temp_files = False
45-
do_heartbeat = True
46-
proxy =
41+
cmd_on_started =
42+
cmd_on_ended =
43+
ffmpeg_path =
44+
log_to_file = True
4745
skip_assemble = False
46+
use_locks = True
4847
```
4948

5049
```username``` **** Instagram username to login with.
5150

5251
```password``` **** Instagram password to login with.
5352

54-
```download_path``` **** Path to the folder where downloaded Instagram livestreams and replays will be saved. PyInstaLive must have permission to write files to this folder. If left empty, PyInstaLive will attempt to fall back to the folder where it's being run from.
53+
```download_path``` **** Path to the folder where downloaded Instagram livestreams will be saved. PyInstaLive must have permission to write files to this folder. If left empty, PyInstaLive will attempt to fall back to the folder where it's being run from.
5554

56-
```download_lives``` **** When set to True, PyInstaLive will download livestreams.
57-
58-
```download_replays``` **** When set to True, PyInstaLive will download any available replays.
59-
60-
```download_comments``` **** When set to true, PyInstaLive will try to download comments from a livestream or replay to a log file. Verified users have *(v)* next to their name.
55+
```download_comments``` **** When set to true, PyInstaLive will try to download comments from a livestream to a text file.
6156

6257
```show_cookie_expiry``` **** When set to True, PyInstaLive will show when the current cookie used to login will expire.
6358

6459
```log_to_file``` **** When set to true, PyInstaLive will save all its console logs to a text file. The filename will be `pyinstalive_<live-username>.log` where `<live_username>` will be the username of the Instagram user whose livestream or replay you want to download. If no username was given to download (e.g when running `pyinstalive --clean`) the file will be named `pyinstalive.default.log`.
6560

6661
```ffmpeg_path``` **** User-defined path to the FFmpeg binary (e.g. `C:\Users\Username\Desktop\ffmpeg.exe`). If left empty, PyInstaLive will fall back to the system's environment variable.
6762

68-
```run_at_start``` **** Command to run when PyInstaLive starts downloading a livestream. Leave empty to disable. (Experimental feature)
63+
```cmd_on_started``` **** Command to run when PyInstaLive starts downloading a livestream. Leave empty to disable. (Experimental feature)
6964

70-
```run_at_finish``` **** Command to run when PyInstaLive finishes downloading a livestream. Leave empty to disable. (Experimental feature)
65+
```cmd_on_ended``` **** Command to run when PyInstaLive finishes downloading a livestream. Leave empty to disable. (Experimental feature)
7166

7267
```use_locks``` **** When set to true, PyInstaLive will create several .lock files to prevent duplicate downloads from starting for the same user if you are running PyInstaLive using some form of automation such as batch/shell loops.
7368

74-
```clear_temp_files``` **** When set to True, PyInstaLive will delete all temporary files that were downloaded as well as the folders which contained these files. Replay folders created by PyInstaLive will not be deleted because they are used to determine if a replay has already been downloaded.
75-
76-
```do_heartbeat``` **** When set to True, PyInstaLive will check the livestream's active status. If set to False no checks will be conducted, and the logged in user will not show up as a viewer during the livestream. May cause degraded performance.
77-
78-
```proxy``` **** When set, PyInstaLive will use the specified HTTP proxy. The format should be similar to http://user:[email protected]:12345
79-
80-
69+
```clear_temp_files``` **** When set to True, PyInstaLive will delete all temporary files that were downloaded as well as the folders which contained these files. Replay folders created by PyInstaLive will not be deleted because they are used to determine if a replay has already been downloaded.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ download_path =
8686
show_cookie_expiry = True
8787
log_to_file = True
8888
ffmpeg_path =
89-
run_at_start =
90-
run_at_finish =
89+
cmd_on_started =
90+
cmd_on_ended =
9191
use_locks = True
9292
clear_temp_files = False
9393
proxy =
@@ -138,7 +138,7 @@ Below is an example of PyInstaLive's output after downloading a livestream:
138138
---------------------------------------------------------------------------
139139
[I] Waiting for background threads to finish.
140140
---------------------------------------------------------------------------
141-
[I] Generating comments text file.
141+
[I] Saving comments to text file.
142142
---------------------------------------------------------------------------
143143
[I] Successfully saved 59 comments.
144144
---------------------------------------------------------------------------

pyinstalive/assembler.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def assemble(user_called=True, retry_with_zero_m4v=False):
3636
ass_mp4_file = os.path.join(pil.dl_path, os.path.basename(ass_json_file).replace("_downloads", "").replace(".json", ".mp4"))
3737
ass_segment_dir = pil.assemble_arg if not pil.assemble_arg.endswith(".json") else pil.assemble_arg.replace(".json", "")
3838

39-
broadcast_info = {}
39+
livestream_info = {}
4040
if not os.path.isdir(ass_segment_dir):
4141
logger.error("Could not create video file: The segment directory does not exist.")
4242
logger.separator()
@@ -49,27 +49,27 @@ def assemble(user_called=True, retry_with_zero_m4v=False):
4949
if not os.path.isfile(ass_json_file):
5050
logger.warn("No matching JSON file found for the segment directory, trying to continue without it.")
5151
ass_stream_id = os.listdir(ass_segment_dir)[0].split('-')[0]
52-
broadcast_info["broadcast_dict"]['id'] = ass_stream_id
53-
broadcast_info["broadcast_dict"]['broadcast_status'] = "active"
54-
broadcast_info['segments'] = {}
52+
livestream_info["broadcast_dict"]['id'] = ass_stream_id
53+
livestream_info["broadcast_dict"]['broadcast_status'] = "active"
54+
livestream_info['segments'] = {}
5555
else:
5656
with open(ass_json_file) as info_file:
5757
try:
58-
broadcast_info = json.load(info_file)
58+
livestream_info = json.load(info_file)
5959
except Exception as e:
6060
logger.warn("Could not decode JSON file, trying to continue without it.")
6161
ass_stream_id = os.listdir(ass_segment_dir)[0].split('-')[0]
62-
broadcast_info["broadcast_dict"]['id'] = ass_stream_id
63-
broadcast_info["broadcast_dict"]['broadcast_status'] = "active"
64-
broadcast_info['segments'] = {}
62+
livestream_info["broadcast_dict"]['id'] = ass_stream_id
63+
livestream_info["broadcast_dict"]['broadcast_status'] = "active"
64+
livestream_info['segments'] = {}
6565

66-
stream_id = str(broadcast_info["broadcast_dict"]['id'])
66+
stream_id = str(livestream_info["broadcast_dict"]['id'])
6767

68-
segment_meta = broadcast_info.get('segments', {})
68+
segment_meta = livestream_info.get('segments', {})
6969
if segment_meta:
7070
all_segments = [
7171
os.path.join(ass_segment_dir, k)
72-
for k in broadcast_info['segments'].keys()]
72+
for k in livestream_info['segments'].keys()]
7373
else:
7474
all_segments = list(filter(
7575
os.path.isfile,

pyinstalive/constants.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Constants:
1212
show_session_expires = True
1313
download_comments = True
1414
clear_temp_files = False
15-
run_at_start =
16-
run_at_finish =
15+
cmd_on_started =
16+
cmd_on_ended =
1717
ffmpeg_path =
1818
log_to_file = True
1919
skip_assemble = False
@@ -26,6 +26,6 @@ class Constants:
2626
REELS_TRAY_URL = 'https://i.instagram.com/api/v1/live/reels_tray_broadcasts/'
2727
BROADCAST_HEALTH_URL = 'https://i.instagram.com/api/v1/live/{:s}/info/'
2828
BROADCAST_HEALTH2_URL = 'https://i.instagram.com/api/v1/live/{:s}/heartbeat_and_get_viewer_count/'
29-
BROADCAST_INFO_URL = 'https://www.instagram.com/{:s}/live/?__a=1'
29+
livestream_info_URL = 'https://www.instagram.com/{:s}/live/?__a=1'
3030
BROADCAST_COMMENTS_URL = 'https://i.instagram.com/api/v1/live/{:s}/get_comment/?last_comment_ts={:s}'
3131
MAIN_SITE_URL = 'https://www.instagram.com/'

0 commit comments

Comments
 (0)