from InstagramAPI import InstagramAPI as IG
from pprint import PrettyPrinter
from getpass import getpass
from random import randint
import time
pp = PrettyPrinter(indent=2)
api = IG(
raw_input('username: '),
getpass('password: ')
)
api.login()
TARGET = {
'username': '',
'media': '',
'media_like': [],
}
TARGET['username'] = raw_input('username target: ')
api.searchUsername(TARGET['username'])
TARGET['user_data'] = api.LastJson['user']
# pp.pprint(TARGET['user_data'])
print('Okay! i want check {0} post.\n'.format(
TARGET['username']
))
api.getUserFeed(str(TARGET['user_data']['pk']))
media = TARGET['media'] = api.LastJson['items']
print('Total Post @{0}: {1} post.'.format(
TARGET['username'],
len(TARGET['media'])
))
print('Like Alllllllll guys')
for item in media:
pp.pprint(item['caption'] or 'no caption')
if item['has_liked']:
print('Udah ke like ini')
else:
hasLiked = api.like(item['id'])
if hasLiked:
print('Berhasil di like')
TARGET['media_like'].append(item['id'])
time.sleep(randint(100,150))
Created
October 30, 2018 07:43
-
-
Save r17x/bfb5bc988860ffd9eef74e14a806b1cb to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ri7nz the code
only grabs 18 posts and not all the posts ! Is there any other way to get all the posts of a user?