Python:Heroku在运行instapy时崩溃
我正在使用python、selenium和instapy为我的网站制作instagram机器人。我从来没有用Python制作过这样的东西 我已经在heroku安装了chrome buildpack和chrome驱动程序。我读到Instapy已经取消了chrome支持,因为chrome经常检测机器人 它显示了以下错误 机器人Python:Heroku在运行instapy时崩溃,python,selenium,selenium-webdriver,heroku,instapy,Python,Selenium,Selenium Webdriver,Heroku,Instapy,我正在使用python、selenium和instapy为我的网站制作instagram机器人。我从来没有用Python制作过这样的东西 我已经在heroku安装了chrome buildpack和chrome驱动程序。我读到Instapy已经取消了chrome支持,因为chrome经常检测机器人 它显示了以下错误 机器人 import os from instapy import InstaPy from instapy import smart_run insta_username = o
import os
from instapy import InstaPy
from instapy import smart_run
insta_username = os.environ['INSTA_USER']
insta_password = os.environ['INSTA_PASSWORD']
# get a session!
session = InstaPy(
username=insta_username,
password=insta_password,
headless_browser=True,
)
# let's go! :
with smart_run(session):
# general settings
session.set_relationship_bounds(
enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=6000,
max_following=3000,
min_followers=30,
min_following=30)
session.set_user_interact(
amount=2, randomize=True, percentage=30, media='Photo')
session.set_do_like(enabled=True, percentage=100)
session.set_do_comment(enabled=True, percentage=5)
session.set_comments([
'Nice shot! @{}', 'I love your profile! @{}', '@{} Love it!',
'@{} :heart::heart:', 'Love your posts @{}', 'Looks awesome @{}',
'Getting inspired by you @{}', ':raised_hands: Yes!',
'@{}:revolving_hearts::revolving_hearts:', '@{}:fire::fire::fire:',
'Your feed is an inspiration :thumbsup:',
'Just incredible :open_mouth:', 'What camera did you use @{}?',
'Love your posts @{}', 'Looks awesome @{}',
'Getting inspired by you @{}', ':raised_hands: Yes!',
'I can feel your passion @{} :muscle:'
],
media='Photo')
# unfollow activity
session.unfollow_users(
amount=126,
nonFollowers=True,
style="RANDOM",
unfollow_after=42 * 60 * 60,
sleep_delay=300)
# follow activity
amount_number = 500
session.follow_user_followers(['chrisburkard', 'danielkordan'],
amount=amount_number,
randomize=False,
interact=True,
sleep_delay=240)
""" Joining Engagement Pods...
"""
session.join_pods(topic='general', engagement_mode='no_comments')
硒
from time import sleep
from selenium import webdriver
from instapy_chromedriver import binary_path
import os
browser = webdriver.Chrome(executable_path=binary_path)
browser.implicitly_wait(5)
browser.get('https://www.instagram.com/')
login_link = browser.find_element_by_xpath("//*[contains(text(), 'Log In')]")
username_input = browser.find_element_by_css_selector("input[name='username']")
password_input = browser.find_element_by_css_selector("input[name='password']")
username_input.send_keys("<your username>")
password_input.send_keys("<your password>")
login_link.click()
sleep(2)
login_button = browser.find_element_by_xpath("//button[@type='submit']")
login_button.click()
sleep(5)
browser.close()
将python in runtime.txt文件的版本更改为3.9.1,您可以尝试手动下载geckodriver并通过cli将其推送到heroku应用程序中……geckodriver仅适用于firefox。。。。修改您的firefox程序将python in runtime.txt文件的版本更改为3.9.1,您可以尝试手动下载geckodriver并通过cli将其推送到heroku应用程序……geckodriver仅适用于firefox。。。。修改firefox的程序你能简单解释一下吗。我是heroku cli的新手,没有得到答案。请原谅浪费您的时间。您可以参考此网站。你会有一个想法,事情是如何运作的,你能简单地解释一下吗。我是heroku cli的新手,没有得到答案。请原谅浪费您的时间。您可以参考此网站。你会有一个想法,在heroku里事情是如何运作的
web: python3 instabot.py