Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Like ou Unlike Instagram
#1
Hi,

I'm beginner in Python, what is the best code to validate if the instagram photo already has like or not ?
because if i run twice my script the result is unlike.

# Goto First Photo of Profile
photo_instagram = driver.find_element_by_class_name('v1Nh3').click()
time.sleep(2)
Thanks
Reply
#2
Please, use proper tags while posting a thread. See Proper Code Tag usage
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
(Jun-08-2020, 06:25 PM)rmiguelantunes74 Wrote: Hi,

I'm beginner in Python, what is the best code to validate if the instagram photo already has like or not ?
because if i run twice my script the result is unlike.

# Goto First Photo of Profile
photo_instagram = driver.find_element_by_class_name('v1Nh3').click()
time.sleep(2)

Thanks

we need more info on how this works to help you.
Reply
#4
Hi,

I have the code for validate

            # Validate Like or Unlike
            btn = driver.find_element_by_xpath(
                '/html/body/div[4]/div[2]/div/article/div[2]/section[1]/span[1]/button')
            aria_label = btn.find_element_by_class_name('_8-yf5 ').get_attribute('aria-label')
            if aria_label == "Like":
                # Like Photo
                like_photo = driver.find_element_by_xpath(
                    '/html/body/div[4]/div[2]/div/article/div[2]/section[1]/span[1]/button')
                like_photo.click()
                time.sleep(3)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Instagram Stories Evil_Patrick 3 48,246 May-31-2022, 12:04 PM
Last Post: RosmenGelik
  Scroll Down Post Instagram Likes rmiguelantunes74 0 3,153 Oct-05-2020, 07:38 PM
Last Post: rmiguelantunes74
  Instagram Bot _ Posting Comments kristianpython 3 3,333 May-23-2020, 12:54 PM
Last Post: kristianpython
  Instagram Phone Emulation kristianpython 0 2,007 May-19-2020, 11:54 AM
Last Post: kristianpython
  Login into Instagram using python kingram 1 12,524 Sep-12-2017, 06:34 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020