Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions insta-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

# Click first thumbnail to open
first_thumbnail = browser.find_element_by_xpath(
"/html/body/div[2]/div/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/article/div[1]/div/div/div[1]/div[1]/a/div[1]/div[2]")
"/html/body/div[2]/div/div/div[2]/div/div/div[1]/div[1]/div[2]/section/main/article/div/div/div/div[1]/div[1]")
first_thumbnail.click()


Expand All @@ -83,11 +83,11 @@
# Check if the post is already liked
# If not, then like, comment, and go to next post
try:
browser.find_element_by_xpath("//button/div/*[*[local-name()='svg']/@aria-label='Unlike']/*")
browser.find_element_by_xpath("//div[@role='button']/div/span/descendant::*[@aria-label='Unlike']")
logger.info("Already liked this post")
except Exception:
# Like
browser.find_element_by_xpath("//button/div/*[*[local-name()='svg']/@aria-label='Like']/*").click()
browser.find_element_by_xpath("//div[@role='button']/div/span/descendant::*[@aria-label='Like']").click()
logger.info("Liked")
likes += 1

Expand All @@ -96,8 +96,8 @@
if do_i_comment == 1:
try:
# Comment
browser.find_element_by_xpath("//div/form").click()
comment = browser.find_element_by_xpath("//form/textarea")
browser.find_element_by_xpath("//article/descendant::section[3]/div/form").click()
comment = browser.find_element_by_xpath("//article/descendant::section[3]/div/form/div/textarea")

sleep(wait_to_comment)

Expand Down