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.
When I run it I get this error. Is this my own account hitting IG's rate limits?
Request return 400 error!
{u'status': u'fail', u'feedback_title': u"Can't like post.", u'feedback_message': u"This post can't be liked right now. Try again in a minute or tell us if you think we made a mistake. We restrict certain content and actions to protect our community. Tell us if you think we made a mistake.", u'spam': True, u'feedback_action': u'report_problem', u'feedback_appeal_label': u'Report problem', u'feedback_ignore_label': u'OK', u'message': u'feedback_required', u'feedback_url': u'repute/report_problem/instagram_like_add/'}
@se7enten i'm sorry for lately reply your comment. maybe you can resolve here mgp25/Instagram-API#1552
@ri7nz the code
media = TARGET['media'] = api.LastJson['items']
print('Total Post @{0}: {1} post.'.format(
TARGET['username'],
len(TARGET['media'])
))
only grabs 18 posts and not all the posts ! Is there any other way to get all the posts of a user?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requirements.txt (python 2.7)