In the example of the schedule automation you get following code. It is unclear to me where to set the username and password. Is this before the def job() or after and between the try?
from instapy import InstaPy
import schedule
import time
def job():
try:
session = InstaPy(selenium_local_session=False) # Assuming running in Compose
session.set_selenium_remote_session(selenium_url='http://selenium:4444/wd/hub')
session.login()
session.set_do_comment(enabled=True, percentage=20)
session.set_comments(['Well done!'])
session.set_do_follow(enabled=True, percentage=5, times=2)
session.like_by_tags(['love'], amount=100, media='Photo')
session.end()
except:
import traceback
print(traceback.format_exc())
schedule.every().day.at("6:35").do(job)
schedule.every().day.at("16:22").do(job)
while True:
schedule.run_pending()
time.sleep(1)
Hello, this is mine. It works, just tried many times:
from instapy import InstaPy
import schedule
import time
insta_username = '{your_username}'
insta_password = '{your_password}'
# set headless_browser=True if you want to run InstaPy on a server
def job():
try:
# set these if you're locating the library in the /usr/lib/pythonX.X/ directory
# Settings.database_location = '/path/to/instapy.db'
# Settings.browser_location = '/path/to/chromedriver'
session = InstaPy(username=insta_username, password=insta_password, headless_browser=True, multi_logs=False)
session.login()
# settings
session.set_lower_follower_count(limit=1000)
session.set_do_follow(enabled=True, percentage=10, times=1)
session.unfollow_users (amount=20, onlyInstapyFollowed=True, onlyInstapyMethod='FIFO', sleep_delay=600, onlyNotFollowMe=False, unfollow_after=168*60*60)
# actions
session.like_by_tags(['tag_1', 'tag_2', 'tag_3', 'tag_4'], amount=100)
session.end()
except:
import traceback
print(traceback.format_exc())
schedule.every().day.at("20:50").do(job)
while True:
schedule.run_pending()
time.sleep(1)
I removed (don't know if it is good or not) the first two rows after "try".
Where could Input the schedule code with my code?
from instapy import InstaPy
insta_username = 'username'
insta_password = 'password'
# if you want to run this script on a server,
# simply add nogui=True to the InstaPy() constructor
session = InstaPy(username=insta_username, password=insta_password, headless_browser=True)
session.login()
# set up all the settings
session.set_relationship_bounds(enabled=True,
max_followers=3000000,
min_followers=1,)
# Interact with the people that a given user is following
# set_do_comment, set_do_follow and set_do_like are applicable
session.set_user_interact(amount=5, randomize=False, percentage=50, media='Photo')
session.set_do_follow(enabled=False, percentage=70)
session.set_do_like(enabled=True, percentage=70)
session.set_comments([u':fire: :fire:', u':heart_eyes: :heart_eyes:'])
session.set_do_comment(enabled=True, percentage=80)
session.interact_user_following(['username'], amount=500, randomize=True)
# do the actual liking
session.like_by_feed(amount=500, randomize=False)
# end the bot session
session.end()
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. > If this problem still occurs, please open a new issue
Most helpful comment
Hello, this is mine. It works, just tried many times:
I removed (don't know if it is good or not) the first two rows after "try".