Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed firefox_profile and some xpath and css selectors. #6718

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mk1995
Copy link

@mk1995 mk1995 commented Jun 11, 2023

Pull Request Template

Description

Made three changes:

  1. emoji and clarifai versions in requirements.txt
  2. Fixed firefox_profile not an arguments error in browser.py
  3. Fixed some xpaths and css selectors for following, liking, users followers and following numbers etc. in xpath_compile.py

Fixes # (issue)
#6716

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have checked my code and corrected any misspellings
  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project, black -t py34
  • My changes generate no new warnings

@gamingofficeyt
Copy link

gamingofficeyt commented Jun 13, 2023

Thanks it worked, atleast almost . Still having issues of detecting the unlike:

INFO [2023-06-13 20:19:52] [ridethelegacy] Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\InstaPy\run.py", line 84, in
session.like_by_tags(my_hashtags, amount=90, media=None)
File "C:\Users\Administrator\Desktop\InstaPy\instapy\instapy.py", line 2006, in like_by_tags
like_state, msg = like_image(
^^^^^^^^^^^
File "C:\Users\Administrator\Desktop\InstaPy\instapy\like_util.py", line 763, in like_image
liked_elem = browser.find_elements(By.XPATH, unlike_xpath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 770, in find_elements
return self.execute(Command.FIND_ELEMENTS, {"using": by, "value": value})["value"] or []
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 346, in execute
self.error_handler.check_response(response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSelectorException: Message: Given xpath expression "[class='x78zum5']>span:nth-child(2)>button" is invalid: SyntaxError: Document.evaluate: The expression is not a legal expression; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#invalid-selector-exception
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:183:5
InvalidSelectorError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:343:5
find_@chrome://remote/content/marionette/element.sys.mjs:168:11
element.find/</findElements<@chrome://remote/content/marionette/element.sys.mjs:116:24
evalFn@chrome://remote/content/marionette/sync.sys.mjs:119:7
PollPromise/<@chrome://remote/content/marionette/sync.sys.mjs:139:5
PollPromise@chrome://remote/content/marionette/sync.sys.mjs:110:10
element.find/<@chrome://remote/content/marionette/element.sys.mjs:114:24
element.find@chrome://remote/content/marionette/element.sys.mjs:113:10
findElements@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:274:25
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:108:31

@gamingofficeyt
Copy link

And if im using your commented line
"unlike": "//[contains(@Class, 'x78zum5')]/button/div/[[local-name()='svg']/@aria-label='Unlike']/",

Its just saying:

INFO [2023-06-13 20:35:02] [ridethelegacy] Image from: b'sebastianstorch'
INFO [2023-06-13 20:35:02] [ridethelegacy] Image link: b'https://www.instagram.com/p/CtcNV9XNooN/'
INFO [2023-06-13 20:35:02] [ridethelegacy] Description: b'#ktm#duke#125#bking1340#suzuki\n#streetfighter#suzukigsxs750\n#sharkexhaust#feierabendrunde\n#sch\xc3\xb6nwars#herrlicheswetter#100kmrunde'
INFO [2023-06-13 20:35:37] [ridethelegacy] --> Image...
INFO [2023-06-13 20:36:02] [ridethelegacy] --> Image was not able to get liked! maybe blocked?
INFO [2023-06-13 20:37:32] [ridethelegacy] --> Invalid Like Element!
INFO [2023-06-13 20:37:32] [ridethelegacy] Like# [2/99]
INFO [2023-06-13 20:37:32] [ridethelegacy] https://www.instagram.com/p/CtcNTrDxmqv/

@mk1995
Copy link
Author

mk1995 commented Jun 20, 2023

Thank you. I also noticed same issue on some other selector path. Its maybe because they use dynamic selector path based on geolocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants