3

我正在尝试学习在 InstaPy 上编码。

首先,我们从使用 Selenium 开始,它工作得很好。

然后,在安装 InstaPy 之后,事情开始变得忙碌起来:显然,instagram 的 cookie 不是通用的,并且会从一个国家到另一个国家而变化。因此,绕过 cookie 页面的代码以相同的方式处理不同的问题。这就是我收到此错误的原因:

未找到 Cookie 文件,正在创建 cookie...

使用 InstaPy 登录后,我得到了这个“接受 cookie”页面,然后得到了前面提到的这个错误。如果我手动单击“全部接受”,它会起作用并继续工作流程。

所以我这里的问题是如何绕过这个问题:我应该修改库中的代码吗?(老实说,我很难理解 InstaPy 类的整个编码。)

还是我应该尝试手动完成所有操作?

"""
This template is written by @loopypanda

What does this quickstart script aim to do?
- My settings is for running InstaPY 24/7 with approximately 1400
follows/day - 1400 unfollows/day running follow until reaches 7500 and than switch to unfollow until reaches 0.
"""

from instapy import InstaPy
from instapy import smart_run

# get a session!
session = InstaPy(username=' ************ ', password=' **************** ', headless_browser= False)

# let's go! :>
with smart_run(session):
    # general settings

    # session.set_relationship_bounds(enabled=True,
    # delimit_by_numbers=False, max_followers=12000, max_following=4500,
    # min_followers=35, min_following=35)
    # session.set_user_interact(amount=2, randomize=True, percentage=100,
    # media='Photo')
    session.set_do_follow(enabled=True, percentage=100)
    session.set_do_like(enabled=True, percentage=100)
    # session.set_comments(["Cool", "Super!"])
    # session.set_do_comment(enabled=False, percentage=80)
    # session.set_user_interact(amount=2, randomize=True, percentage=100,
    # media='Photo')

    # activity

    # session.interact_user_followers(['user1', 'user2', 'user3'],
    # amount=8000, randomize=True)
    # session.follow_user_followers(['user1', 'user2', 'user3'],
    # amount=8000, randomize=False, interact=True)
    # session.unfollow_users(amount=7500, nonFollowers=True, style="RANDOM",
    # unfollow_after=42*60*60, sleep_delay=3)
    session.like_by_tags(['???'], amount=8000)

    """ Joining Engagement Pods...
    """
    photo_comments = ['Nice shot! @{}',
        'I love your profile! @{}',
        '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:']
    session.set_do_comment(enabled = True, percentage = 95)
    session.set_comments(photo_comments, media = 'Photo')
    session.join_pods(topic='food')
4

0 回答 0