samuelchristlie / PyInstaLive

Python script to download Instagram livestreams.
MIT License
6 stars 0 forks source link

Can not record live stream with cookies #1

Open kdurov opened 3 weeks ago

kdurov commented 3 weeks ago

(The template is too outdated so I deleted them all)

Thanks for the fork. Unfortunately I still can't record live stream with lastest fork (pyinstalive-4.0.3b0-py3-none-any.whl size=25343 sha256=a4946df7daf2fba010a30f2ef58b99db7bdd02350e074f26f78345a01093535e) .dat file can be generated normally with cookies file but nothing can be downloaded. Instagram instantly shut down the access

[I] Livestream available, starting download.
---------------------------------------------------------------------------
[I] Downloading livestream, press [CTRL+C] to abort.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
[E] The livestream host has possibly lost connection with Instagram.
---------------------------------------------------------------------------
[I] The livestream has been ended.
---------------------------------------------------------------------------
[I] Airing time  : 2 minutes and 19 seconds
[I] Downloaded   : 0 minute and 1 seconds
[I] Missing      : 2 minutes and 18 seconds

only an empty folder is added.

It's kinda hard to do testing cuz there is no easy find to find currently live account.

kdurov commented 2 weeks ago

Thank you @samuelchristlie It seems that this issue is fixed now

Could you please add an explicit directive in pyinstalive.ini config for cookies file's path? For security reason I don't want to put cookie files in the same directory of pyinstalive.ini and recorded stream files. Cookies files can no longer be limited to .txt extension as well. Something like

[pyinstalive]
username = johndoe
password = grapefruit
dat_path = 
cookies_path = 
download_path = 
ffmpeg_path = 
download_comments = True    
cmd_on_started =
cmd_on_ended =
clear_temp_files = False
use_locks = True
no_assemble = False
log_to_file = True

Thanks

samuelchristlie commented 2 weeks ago

You should be able to specify session_file (.dat files) and cookies_file (.txt filse) now.

[pyinstalive]
username = johndoe
password = grapefruits
session_file = ../sessions/johndoe.dat
cookies_file = ../cookies/johndoe.txt
download_path = {:s}
download_comments = True
clear_temp_files = True
cmd_on_started =
cmd_on_ended =
ffmpeg_path = 
log_to_file = True
no_assemble = False
use_locks = True
send_heartbeat = True
proxy =

You should be able to use any file extensions, but I haven't tested it with other cookies format.

kdurov commented 2 weeks ago

Thanks again for the update.

session_file = ../sessions/johndoe.dat
cookies_file = ../cookies/johndoe.txt

I tested latest commit and here's what I found.

  1. Currently cookies file can use any extension but only netscape format is supported.
  2. Config file supports relative path name like . and .. However, home directory's ~ or $HOME aren't supported yet.
  3. A valid path has to be present in session_file option if cookies_file option exists. Could you use the same directory as specified cookies file but with .dat extension as default if it's not specified?
  4. username and password are still required even when cookies and session files are specified.
    [E] Could not validate the configuration file: No option 'username' in section: 'pyinstalive'
    [E] Ensure the configuration file and given arguments are valid and try again.

Nothing serious but hopefully pyinstalive can be more user friendly with these improvements. Thanks.

samuelchristlie commented 4 days ago

I'll try to fix the additional cookie feature first before fixing the core features.

What format of cookies are you using?

kdurov commented 23 hours ago

I'm using netscape format which is the only accepted format. I'm not against this but the README is kind of confusing

To load JSON cookies to PyInstaLive, create a username.txt file containing the Netscape-formatted cookies