Fix api.py according to new Instagram API format
Currently Instagram returns csrf_token inside nested object called config. These changes fix it.
Hi, I have the same problem with windows10. Could not login: Expecting value: line 1 column 1 (char 0) How can I fix it? How I can update api.py? Can you guide me? Thanx for help!
hi @BeatrixKiddo3000, just recreate changes i've made in this PR on your local files and you're good to go
I tried making these changes and it now returns a different error.
[E] Could not login: HTTPSConnectionPool(host='www.instagram.com', port=443): Read timed out. (read timeout=5)
If I use an old login session, it gets past this and goes into the error mentioned in another thread:
[E] Could not get livestream information: Expecting value: line 1 column 1 (char 0)
Hi, I have the same problem with windows10. Could not login: Expecting value: line 1 column 1 (char 0) How can I fix it? How I can update api.py? Can you guide me? Thanx for help!
You can install it by using the commit code, like so:
pip install git+https://github.com/dvingerh/PyInstaLive.git@0c6c53161efda1c3a96787206544015a81ee159c
You can install it by using the commit code, like so:
pip install git+https://github.com/dvingerh/PyInstaLive.git@0c6c53161efda1c3a96787206544015a81ee159c
Don't work, same error: [E] Could not login: Expecting value: line 1 column 1 (char 0)
What can I do?
You can install it by using the commit code, like so:
pip install git+https://github.com/dvingerh/PyInstaLive.git@0c6c53161efda1c3a96787206544015a81ee159cDon't work, same error: [E] Could not login: Expecting value: line 1 column 1 (char 0)
What can I do?
yes, it didn't work, the file in the folder wasn't updated do it manually:
download the raw directly from https://github.com/dvingerh/PyInstaLive/blob/0c6c53161efda1c3a96787206544015a81ee159c/pyinstalive/api.py and replace it with the api.py in this folder C:\Users\username\AppData\Local\Programs\Python\Python39\Lib\site-packages\pyinstalive
then it works
but now I have this error [I] Successfully created a new login session file: xxx.dat [E] Could not login: "name='csrftoken', domain=None, path=None" ... [I] An existing login session file was found: xxx.dat [I] Checking the validity of the saved login session. [E] Could not login: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
I've downgraded to version 3.24 and updated the .ini file, now I can login and hopefully record the next stream when it starts
pip install git+https://github.com/notcammy/[email protected] --upgrade
https://github.com/dvingerh/PyInstaLive/blob/3.2.4/README.md
Downgrading to 3.2.4 appears to have worked. Much appreciated!
work me too downgrading to 3.2.4 version with old .ini file
but after only 3 hours give me this error: "Could not finish checking following users: Unauthorized: Please wait a few minutes before you try again"
If i delete cookie work for 3 hours and then the same error....
This PR still does not work here:
G:\_temp\instalive\PyInstaLive>python -m pyinstalive -d daaai_chan
---------------------------------------------------------------------------
[I] PYINSTALIVE (SCRIPT V4.0.2 - PYTHON V3.11.1) - 12-24-2022 06:18:46 PM
---------------------------------------------------------------------------
[I] An existing login session file was found: ***.dat
[I] Checking the validity of the saved login session.
---------------------------------------------------------------------------
[I] Successfully logged in using account: ***
[I] The login session file will expire on: 07-15-2023 at 12:05:15 PM
---------------------------------------------------------------------------
[I] Getting livestream information for user: daaai_chan
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "G:\_temp\instalive\PyInstaLive\pyinstalive\__main__.py", line 9, in <module>
run()
File "G:\_temp\instalive\PyInstaLive\pyinstalive\startup.py", line 168, in run
globals.download.start()
File "G:\_temp\instalive\PyInstaLive\pyinstalive\download.py", line 40, in start
user_info = api.get_user_info().get("data", {}).get("user", None)
^^^^^^^^^^^^^^^^^^^
File "G:\_temp\instalive\PyInstaLive\pyinstalive\api.py", line 29, in get_user_info
return json.loads(response.text) if response.status_code == 200 else {}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
It's trying to fetch https://i.instagram.com/api/v1/users/web_profile_info/?username={username} but the response is HTML, not JSON
work me too downgrading to 3.2.4 version with old .ini file
but after only 3 hours give me this error: "Could not finish checking following users: Unauthorized: Please wait a few minutes before you try again"
If i delete cookie work for 3 hours and then the same error....
I made a python script to delete your cookies automatically:
import os
import time
username = "your_instagram_username"
cookie_dir = "/path/to/pyinstalive/"
times_run = 0
print("Automatic Cookie Deleter for pyinstalive")
hours = input("Choose hourly interval: ")
while True:
print("Deleting cookies every " + hours + " hour(s)")
time.sleep(3600 * float(hours))
os.system("rm '" + cookie_dir + username + ".json'")
times_run = times_run + 1
print("Cookies deleted a total of " + str(times_run) + " time(s)")
Make sure you change the username = and cookie_dir = values to match your username as well as your pyinstalive location.
Run this in another terminal window. If you're using Windows, I think you might have to replace rm with del in os.system(), but otherwise the command should work across Unix-like systems (such as Mac and Linux).
When you run the program, it will ask you how often you'd like for the cookies to be deleted in hours. Decimal points work too! Press enter, and the program will continue to run until you decide to close it.
I made a python script to delete your cookies automatically:
Could you do a script that allow use my chrome cookies as .dat file for this ?