forked from tmhlsky/Instagram-API-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from xecgr/master
close issue getUserFollowings outdated #133
- Loading branch information
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from InstagramAPI import InstagramAPI | ||
import time | ||
from datetime import datetime | ||
|
||
username = '' | ||
pwd = '' | ||
user_id = '19343908' | ||
|
||
|
||
API = InstagramAPI(username,pwd) | ||
API.login() | ||
|
||
following = [] | ||
next_max_id = True | ||
while next_max_id: | ||
print next_max_id | ||
#first iteration hack | ||
if next_max_id == True: next_max_id='' | ||
_ = API.getUserFollowings(user_id,maxid=next_max_id) | ||
following.extend ( API.LastJson.get('users',[])) | ||
next_max_id = API.LastJson.get('next_max_id','') | ||
|
||
len(following) | ||
unique_following = { | ||
f['pk'] : f | ||
for f in following | ||
} | ||
len(unique_following) |