Instapy: --> Invalid Like Element!

Created on 3 Jul 2018  路  12Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

--> Image Liked!

Current Behavior

--> Invalid Like Element!

Possible Solution (optional)

Replace the xpaths with these one in the like_util.py like_image function:

def like_image(browser, username, blacklist, logger, logfolder):
...
    like_xpath = "//article//button[contains(@class, 'Heart')]/span[text()='Like']/.."
    unlike_xpath = "//article//button[contains(@class, 'Heart')]/span[text()='Unlike']/.."
    spans = [x.text.lower() for x in browser.find_elements_by_xpath("//article//button[contains(@class, 'Heart')]/span")]
...

InstaPy configuration

Most helpful comment

@HansDaigle is working also with this

like_xpath = "//button/span[text()='Like']/.."
unlike_xpath = "//button/span[text()='Unlike']"

# fetch spans fast
spans = [x.text.lower() for x in browser.find_elements_by_xpath("//article//button/span")]

All 12 comments

@HansDaigle is working also with this

like_xpath = "//button/span[text()='Like']/.."
unlike_xpath = "//button/span[text()='Unlike']"

# fetch spans fast
spans = [x.text.lower() for x in browser.find_elements_by_xpath("//article//button/span")]

Yep, gettin this one as well

Me as well.

Same

Same for me Today .

@HansDaigle this guy has the right solution!! Thank you!

def like_image(browser, username, blacklist, logger, logfolder):
...
like_xpath = "//article//button[contains(@class, 'Heart')]/span[text()='Like']/.."
unlike_xpath = "//article//button[contains(@class, 'Heart')]/span[text()='Unlike']/.."
spans = [x.text.lower() for x in browser.find_elements_by_xpath("//article//button[contains(@class, 'Heart')]/span")]
...

Putting that in the like_util.py is the right solution.

@HansDaigle Thanks man it's working again, please raise a PR for this.

Works

@HansDaigle Works!

@ArdyBeheshti great job, can you PR that ?

It's already in master guys 馃憤!

It isn't working for me when the post is a collection

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spyd3r0us picture Spyd3r0us  路  3Comments

deronsizemore picture deronsizemore  路  3Comments

thisishotdog picture thisishotdog  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

v77v picture v77v  路  3Comments