InstaPy / InstaPy/instapy-quickstart

Failed to get followers, following and unfollowers counts

Ouverte
#154 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
777
Forks
763
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

On Windows 10 running through PyCharm.

I'm trying to get my followers and unfollowers from my original account (pre InstaPy) but InstaPy is unable to find them.

I run the following code:

```
from instapy import InstaPy
from instapy import smart_run

def job():
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
want_check_browser=False,
headless_browser=True,
disable_image_load=True)
with smart_run(session):
session.set_quota_supervisor(enabled=True,
sleep_after=["likes", "comments_d", "follows",
"unfollows", "server_calls_h"],
sleepyhead=True, stochastic_flow=True,
notify_me=True,
peak_likes_hourly=55,
peak_likes_daily=566,
peak_comments_hourly=33,
peak_comments_daily=182,
peak_follows_hourly=55,
peak_follows_daily=None,
peak_unfollows_hourly=22,
peak_unfollows_daily=333,
peak_server_calls_hourly=None,
peak_server_calls_daily=4700)

nonfollowers = session.pick_nonfollowers(
username="kevinjohnsrude",
store_locally=True,
live_match=True)
print(nonfollowers)

job()
```

Here's my output:

```
InstaPy Version: 0.6.8
._. ._. ._. ._. ._. ._. ._. ._. ._.
Workspace in use: "C:/Users/Kevin/InstaPy"
INFO [2020-05-07 20:20:34] [kevinjohnsrude] Session started!
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
....................................................................
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2020-05-07 20:20:44] [kevinjohnsrude] Logged in successfully!
INFO [2020-05-07 20:20:44] [kevinjohnsrude] Saving account progress...
INFO [2020-05-07 20:21:37] [kevinjohnsrude] Failed to get followers count of 'b'kevinjohnsrude'' ~empty list
INFO [2020-05-07 20:22:27] [kevinjohnsrude] Failed to get following count of 'b'kevinjohnsrude'' ~empty list
WARNING [2020-05-07 20:22:27] [kevinjohnsrude] Unable to save account progress, skipping data update Message: TypeError: window._sharedData is undefined

INFO [2020-05-07 20:22:39] [kevinjohnsrude] Starting to pick Nonfollowers of kevinjohnsrude..
INFO [2020-05-07 20:22:39] [kevinjohnsrude] Retrieving live `Followers` data of kevinjohnsrude at "full" range
______________________________________________________________________________________________
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
INFO [2020-05-07 20:23:29] [kevinjohnsrude] Failed to get followers count of 'b'kevinjohnsrude'' ~empty list
INFO [2020-05-07 20:24:19] [kevinjohnsrude] Failed to get following count of 'b'kevinjohnsrude'' ~empty list
INFO [2020-05-07 20:24:19] [kevinjohnsrude] Sessional Live Report:
|> No any statistics to show

[Session lasted 3.85 minutes]
INFO [2020-05-07 20:24:19] [kevinjohnsrude] Session ended!
Traceback (most recent call last):
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\instapy\relationship_tools.py", line 86, in get_followers

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

"return window.__additionalData[Object.keys(window.__additionalData)[0]].data."
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: TypeError: window.__additionalData[Object.keys(...)[0]] is undefined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/Kevin/Documents/PycharmProjects/ig/ig.py", line 88, in
job()
File "C:/Users/Kevin/Documents/PycharmProjects/ig/ig.py", line 85, in job
live_match=True)
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\instapy\instapy.py", line 4417, in pick_nonfollowers
self.logfolder,
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\instapy\relationship_tools.py", line 703, in get_nonfollowers
logfolder,
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\instapy\relationship_tools.py", line 91, in get_followers
"return window._sharedData." "entry_data.ProfilePage[0]." "graphql.user.id"
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Kevin\.conda\envs\ig\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: TypeError: window._sharedData is undefined

Process finished with exit code 1
```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with relationship_tools.py in get_followers and get_nonfollowers, then trace the call from instapy.py through pick_nonfollowers. Reproduce the provided script and inspect the Selenium execute_script failures involving window.__additionalData and window._sharedData; done means follower and following counts are retrieved without the reported JavaScript exceptions.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.