InstaPy / InstaPy

📷 Instagram Bot - Tool for automated Instagram interactions
GNU General Public License v3.0
16.57k stars 3.74k forks source link

json decoding error #6210

Open stikkeruip opened 3 years ago

stikkeruip commented 3 years ago

I'm trying to run the session.like_by_feed() command, and it works for a few posts and then it throws an error. The error happens randomly everytime and I've been trying to figure out what could be causing it. Here are the errors I get.

File "C:\Users\uipko\Desktop\instapyproj\venv\lib\site-packages\instapy\instapy.py", line 4126, in like_by_feed for _ in self.like_by_feed_generator(amount, randomize, unfollow, interact):

File "C:\Users\uipko\Desktop\instapyproj\venv\lib\site-packages\instapy\instapy.py", line 4233, in like_by_feed_generator ) = check_link(

File "C:\Users\uipko\Desktop\instapyproj\venv\lib\site-packages\instapy\like_util.py", line 577, in check_link post_page = get_additional_data(browser)

File "C:\Users\uipko\Desktop\instapyproj\venv\lib\site-packages\instapy\util.py", line 2577, in get_additional_data additional_data = json.loads(text[48:-2])

File "C:\ProgramFiles\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads return _default_decoder.decode(s)

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "C:\ProgramFiles\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\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)

I've tried resetting the followRestriction.json and the recordActivity.json but it still fails. Any help is appreciated!

schealex commented 3 years ago

hey @stikkeruip can you give a sample configuration to test this? Have you changed any code or are you running the current release build?

stikkeruip commented 3 years ago

Thanks for the reply @schealex. I am using your #6195 branch because of an error like_util was creating.

`def likes(_user, _pass, amount): session = InstaPy(username=_user, password=_pass) session.login()

session.like_by_feed(amount=int(amount), randomize=False, unfollow=False, interact=True)

session.end()`

This is what gets run incase I've written anything wrong. I'm new to Python and github in general so if there are any files you need please let me know.

I'm also running Python3.9 incase that causes any issues

schealex commented 3 years ago

i'd need to setup a config and test account for that. might check it today if i have the time. Will let you know if i encounter the same issue and have a fix :)

stikkeruip commented 3 years ago

i'd need to setup a config and test account for that. might check it today if i have the time. Will let you know if i encounter the same issue and have a fix :)

Okk thank you so much !

yaelsprikut commented 3 years ago

Any update on this? I'm currently having the same issue. It's only happening on accounts that are private.

erikbrandondigital commented 3 years ago

I am currently experiencing the same issue as well. I am running Python 3.9 and Instapy Version: 0.6.14. Here is the code from my configuration file that calls the like_by_feed function.

with smart_run(session):
    session.like_by_feed(amount=20, randomize=False, unfollow=False, interact=False)

I wonder if it is happening due to some kind of post URL structure change on Instagram. As shown in the screenshot, Instapy crashed when it was supposed to interact with a post with a different URL structure. As far as I have seen so far this happens from time to time. This might be the cause but I am unsure. I hope this traceback helps.

image

Bumos commented 3 years ago

Hi guys! Any update on this? I noticed that the error appears when video content is added to the page. Maybe you need to update chromedriver? When autoplay video content

Bumos commented 3 years ago

Hi guys! I solved problem by insertion try-except on the block: additional_data = json.loads(text[48:-2])

erikbrandondigital commented 2 years ago

@Bumos Could you share a screenshot or paste a snippet of the code change you made that solved the issue? I'd like to see if it works for me too.