InstaPy quickstart.py - PullRequest
       95

InstaPy quickstart.py

0 голосов
/ 06 августа 2020

Я установил Python 3.8.2 и установил Instapy с помощью видеоурока и запуска установки, когда я запускаю InstaPy quickstart.py, происходит сбой:

Workspace in use: "/home/skiw/InstaPy"

 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
INFO [2020-08-06 19:10:24] [username]  Using built in instapy-chromedriver executable (version 2.44)

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2020-08-06 19:10:26] [username]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo

Cookie file not found, creating cookie...
**********************************************************************
If raising an issue, please also upload the file located at:
/tmp/20200806-191059.html
**********************************************************************

INFO [2020-08-06 19:10:59] [username]  Sessional Live Report:
    |> No any statistics to show


[Session lasted 35.17 seconds]

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2020-08-06 19:10:59] [username]  Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooo



Traceback (most recent call last):
  File "quickstart.py", line 20, in <module>
    with smart_run(session):
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/skiw/.local/lib/python3.8/site-packages/instapy/util.py", line 1662, in smart_run
    session.login()
  File "/home/skiw/.local/lib/python3.8/site-packages/instapy/instapy.py", line 366, in login
    if not login_user(self.browser,
  File "/home/skiw/.local/lib/python3.8/site-packages/instapy/login_util.py", line 203, in login_user
    login_elem = browser.find_element_by_xpath(
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//article//a[text()='Log in']"}
  (Session info: headless chrome=84.0.4147.105)
  (Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 5.4.0-42-generic x86_64)

Мой файл quickstart.py это ( имя пользователя и пароль удалены по очевидным причинам):

Я искал возможное решение в Интернете, но пока не нашел того, что работает. Есть идеи, как я могу это исправить?

Спасибо

This template is written by @zackvega
What does this quickstart script aim to do?
- This is my simple but effective script.
"""

from instapy import InstaPy
from instapy import smart_run

insta_username = ''
insta_password = ''

# get a session!
session = InstaPy(username=insta_username,
                  password=insta_password,
                  headless_browser=True,
                  multi_logs=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:'],
        media='Photo')

    # unfollow activity
    session.unfollow_users(amount=126, nonFollowers=True, style="RANDOM",
                           unfollow_after=42 * 60 * 60, sleep_delay=300)

    # follow activity
    ammount_number = 500
    session.follow_user_followers(['chrisburkard', 'danielkordan'],
                                  amount=ammount_number, randomize=False,
                                  interact=True, sleep_delay=240)

    """ Joining Engagement Pods...
    """
    session.join_pods(topic='entertainment', engagement_mode='no_comments') ``` 


...