Clarifai ImageAPI - MohanSha/InstaPy GitHub Wiki
Note: Head over to https://developer.clarifai.com/signup/ and create a free account, once you’re logged in go to https://developer.clarifai.com/account/applications/ and create a new application. You can find the client ID and Secret there. You get 5000 API-calls free/month.
If you want the script to get your Clarifai_ID and Clarifai_Secret for your environment, you can do:
export CLARIFAI_ID="<ProjectID>"
export CLARIFAI_SECRET="<Project Secret>"
from instapy import InstaPy
InstaPy(username='test', password='test')\
.login()\
.set_do_comment(True, percentage=10)\
.set_comments(['Cool!', 'Awesome!', 'Nice!'])\
.set_dont_include(['friend1', 'friend2', 'friend3'])\
.set_dont_like(['food', 'girl', 'hot'])\
.set_ignore_if_contains(['pizza'])\
.set_use_clarifai(enabled=True)\
.clarifai_check_img_for(['nsfw'])\
.clarifai_check_img_for(['food', 'lunch', 'dinner'], comment=True, comments=['Tasty!', 'Nice!', 'Yum!'])\
.like_by_tags(['dog', '#cat'], amount=100)\
.end()
#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, secret='xyz', proj_id='123')
# uses the clarifai api to check if the image contains nsfw content
# -> won't comment if image is nsfw
session.clarifai_check_img_for(['nsfw'])
#checks the image for keywords food and lunch, if both are found,
#comments with the given comments. If full_match is False (default), it only
# requires a single tag to match Clarifai results.
session.clarifai_check_img_for(['food', 'lunch'], comment=True, comments=['Tasty!', 'Yum!'], full_match=True)