InstaPy / InstaPy

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

Clarifai Throttle (cry for help) #384

Closed balakedev closed 7 years ago

balakedev commented 7 years ago

Having some consistent issues with using Clarifai. I'm on V2 and I definitely haven't used all my free usage. All I've done is entered my secret and my proj_id and changed the tags and comments. Getting throttled 100% of the time.

Can anyone that has managed to get their Clarifai API working point me in the right direction?

Code below:


"""Image Check with Image tagging api"""

#'Clarifai_SECRET' and 'CLARIFAI_ID'

session.set_use_clarifai(enabled=True, secret='#', proj_id='#')

session.set_use_clarifai(enabled=False)
session.set_use_clarifai(enabled=True) 

session.clarifai_check_img_for(['nsfw'], comment=False) 

session.clarifai_check_img_for(['travel', 'vacation','holiday','tourist'], comment=True, comments=['were jealous!', 'enjoy!', 'So cool!!', 'next time you travel, be sure to check us out!! :)'])
diveu commented 7 years ago

Hi! You should probably ask about it on clarifai forum. https://community.clarifai.com. Usually they say that you've exceeded the quotas. And you should probably look at server responses. And by the way: you are using #'Clarifai_SECRET' and 'CLARIFAI_ID'. Aren't they from v1? Or v2 should work as well?

balakedev commented 7 years ago

To be honest, i have no idea, i'm a rookie with all of this - i'm learning as I go. Do you have a working version of Instapy with clarifai running? It would be great if i had a working version i could compare mine to. @diveu

timgrossmann commented 7 years ago

@blakemmw First, go to the clarifai webpage and check your monthly usage, if this is at the maximum, you can't do anything about it but wait or buy more calls.

Here is a working code snippet:

.set_use_clarifai(enabled=True, secret='#', proj_id='#')
.clarifai_check_img_for(['nsfw'])
.clarifai_check_img_for(['travel'], comment=True, comments=['nice!'])

Why do you do this three times?

session.set_use_clarifai(enabled=True, secret='#', proj_id='#')

session.set_use_clarifai(enabled=False)
session.set_use_clarifai(enabled=True) 
balakedev commented 7 years ago

@timgrossmann copied in the working code snippet and inserted my secret and proj_id and im getting syntax errors. it only runs if i have:

session.set_use_clarifai(enabled=True, secret='#', proj_id='#') 
sesssion.clarifai_check_img_for(['nsfw'])
session.clarifai_check_img_for(['travel'], comment=True, comments=['nice!'])

If these are in place im still getting a throttle error. also tried just having NSFW running an its still not going. i looked up my usage and its <300.

timgrossmann commented 7 years ago

@blakemmw What does the rest of your quickstart file look like? Please paste the whole quickstart file here.

balakedev commented 7 years ago

@timgrossmann , here you go:

from instapy import InstaPy

# Write your automation here
# Stuck ? Look at the github page or the examples in the examples folder

dont_like = ['food', 'girl', 'hot']
ignore_words = ['pizza']
friend_list = ['friend1', 'friend2', 'friend3']

# If you want to enter your Instagram Credentials directly just enter
# username=<your-username-here> and password=<your-password> into InstaPy
# e.g like so InstaPy(username="instagram", password="test1234")

InstaPy()\
  .login()\
  .set_upper_follower_count(limit = 2500) \
  .set_do_comment(True, percentage=10) \
  .set_comments(['Cool!', 'Awesome!', 'Nice!']) \
  .set_dont_include(friend_list) \
  .set_dont_like(dont_like) \
  .set_ignore_if_contains(ignore_words) \
  .like_by_tags(['dog', '#cat'], amount=100) \
  .end()
timgrossmann commented 7 years ago

@blakemmw But where is the clarifai part?

balakedev commented 7 years ago

@timgrossmann Was i supposed to add something in to this file? Like i said, fairly new to all this..

timgrossmann commented 7 years ago

@blakemmw Where did you add the clarifai? Where did you write the clarifi part in?

Yes, you're running it with python quickstart.py so you have to edit this file 😉

balakedev commented 7 years ago

@timgrossmann Ahhhh i think we have totally misunderstood each other. I'm not using quickstart.py to running instapy. I created my own files that I run, all with different hashtags and comment that my pc runs at random at key times per day. There's 9 of them so the bot covers a wider area of instagram. I'll grab one of the documents and I'll show you what i'm doing.

balakedev commented 7 years ago

At the moment Clarifai is commented out, but if i add what you suggested earlier i get a syntax error. so in order to have the script not throttle, clariafai is completely commented out.

"""Example Case of the Script"""
from instapy import InstaPy

#if you don't provide arguments, the script will look for INSTA_USER and INSTA_PW in the environment
session = InstaPy(username='#', password='#')

"""Logging in"""
#logs you in with the specified username and password
session.login()

"""Comment util"""
#default enabled=False, ~ every 4th image will be commented on
session.set_do_comment(enabled=True, percentage=27)
session.set_comments(['Awesome!!', 'This is so Cool', '#goals', 'wow!!', ':D', 'nice one','top stuff','love your work:)','great'])

"""Follow util"""
#default enabled=False, follows ~ every 10th user from the images
session.set_do_follow(enabled=True, percentage=25, times=2)

"""Image Check with Image tagging api"""
#default enabled=False , enables the checking with the clarifai api (image tagging)
#if secret and proj_id are not set, it will get the environment Variables
#'Clarifai_SECRET' and 'CLARIFAI_ID'
#session.set_use_clarifai(enabled=True,s timecret='', proj_id='')
#                                        ^
# ^If specified once, you don't need to add them again

#session.set_use_clarifai(enabled=False)
#session.set_use_clarifai(enabled=True) #<- will use the one from above

#uses the clarifai api to check if the image contains nsfw content
# Check out their homepage to see which tags there are -> won't comment on image
# (you won't do this on every single image or the 5000 free checks are wasted very fast)
#session.clarifai_check_img_for(['nsfw'], comment=False) # !if no tags are set, use_clarifai will be False

#checks the image for keywords food and lunch, if found, sets the comments possible comments
#to the given comments
#session.clarifai_check_img_for(['food', 'lunch'], comment=True, comments=['Tasty!', 'Yum!'])
#session.clarifai_check_img_for(['dog', 'cat', 'cute'], comment=True, comments=['Sweet!', 'Cutie!!!'])
#session.clarifai_check_img_for(['travel', 'vacation','holiday','tourist'], comment=True, comments=['were jealous!', 'enjoy!', 'So cool!!', 'next time you travel, be sure to check us out!! :)'])

"""Like util"""
#completely ignore liking images from certain users
#session.set_ignore_users(['random_user', 'another_username'])
#searches the description and owner comments for the given words
# and won't like the image if one of the words are in there
session.set_dont_like(['nsfw'])
#will ignore the don't like if the description contains
# one of the given words
#session.set_ignore_if_contains(['glutenfree', 'french', 'tasty'])

"""Unfollow util"""
#will prevent commenting and unfollowing your good friends
session.set_dont_include(['#', '#','#','#','#','#','#'])

"""Different tasks"""
# you can put in as much tags as you want, likes 100 of each tag
session.like_by_tags([  '#holiday', '#tourist', '#traveling','#travelphotography', '#travelwriter ', '#campervanlife','#instatravel', '#travelblogger ', '#wander','#travler', '#instapassport', '#photography', '#travelblog', '#vacation', '#explore','travel'], amount=45)

"""Ending the script"""
#clears all the cookies, deleting you password and all information from this session
session.end()
timgrossmann commented 7 years ago

@blakemmw hmm good question, you should write the support of clarifai what the problem could be. I really don't know. I had this problem several times, but it always was the case that I reached the limit of free requests for that month.