ability to like the targeted element defined on the code
this element doesn't exist anymore, so the script is not able to find it
Update the code with the new element definition :
xpath["like_image"] = {
"like": "//section/span/button/div[[local-name()='svg']/@aria-label='Like']",
"unlike": "//section/span/button/div[[local-name()='svg']/@aria-label='Unlike']",
}
Modify the definition of the Like element
Here some details of a possible resolution from @Lisiadito :
xpath["like_image"] = {
"like": "//section/span/button/div[[local-name()='svg']/@aria-label='Like']",
"unlike": "//section/span/button/div[[local-name()='svg']/@aria-label='Unlike']",
}
It just need to be updated into the code directly
from today same issue for me
try solution from Mohanbarman in "pull request" but nothing
from today same issue for me
try solution from Mohanbarman in "pull request" but nothing
any update?
from today same issue for me
try solution from Mohanbarman in "pull request" but nothingany update?
No.....
I try Many Version of xpath and i try to modify myself the xpath but nothing
Waiting for help....
Same issue here!
same issue here as well.
Any update about the problem??
there is a open PR which should fix this problem. for now you can change these lines in the file xpath_compile.py
xpath["like_image"] = {
"like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']",
"unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']",
}
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
I just tried this, and it worked well. Thanks!
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Worked for me too ! Thank you @Lisiadito
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Still dosen't work for me, just me?
@bronzeboy what version of InstaPy do you have installed?
Tomorrow try to reset my raspberry and reinstall all...
I hope is only a corrupt python library
@bronzeboy what version of InstaPy do you have installed?
The last one 0.6.9 and I manually upgraded browser.py and xpath from github latest commit
@bronzeboy not sure what you updated in the browser.py but with a clean 0.6.9 install and then modifying the xpath_compile.py
with the changes i suggested it should work.
@bronzeboy not sure what you updated in the browser.py but with a clean 0.6.9 install and then modifying the
xpath_compile.py
with the changes i suggested it should work.
Hi!, I did this exactly this and did not work for me. All im using is the feature like by tag on my code... idk still get the invalid like element
@angelonso I've encountered this problem too.I "was" using python 3.7 in Spyder and Mozilla Firefox (the latest version, I think it's 0.78),Windows 10 64bit. I tried changing the xpath_compile.py 'like-image' codepiece but still gave 1.Invalid like element, and 2. Wrong pathway error.
Tried the solutions here, no avail ,so I went to my other device(same python version) but I had Mozilla developer. It works without changing any code(still puzzled why).
If that doesn't work then implement the suggested code above to a lower version of Mozilla or firebug.
@english-coconut Thank you very much for yoy reply! I finally managed to make it work. For me it world using the developer browser and changing the code. Also no idea why but thank you 馃憤:D
Tomorrow try to reset my raspberry and reinstall all...
I hope is only a corrupt python library
did u manage to solve it on raspberry?
@bronzeboy not sure what you updated in the browser.py but with a clean 0.6.9 install and then modifying the
xpath_compile.py
with the changes i suggested it should work.
It was an error by my part, sorry and thanks!
Tomorrow try to reset my raspberry and reinstall all...
I hope is only a corrupt python librarydid u manage to solve it on raspberry?
This morning I reset my raspberry .....
try on "rpi3 b+" and "rpi2 b"
And than:
INSTALL OS
For work:
xvfb-run python3 yourscript.py
Everything work without any modification
In the last build is already modified browser.py (hide selenium extension) and xpath_compile.py
Cron is ok with xvfb
I think my old problem was with some python library but i'm unable to remove old library from os
Many than to everyone and may thanks to @Lisiadito
Tomorrow try to reset my raspberry and reinstall all...
I hope is only a corrupt python librarydid u manage to solve it on raspberry?
This morning I reset my raspberry .....
try on "rpi3 b+" and "rpi2 b"
And than:INSTALL OS
- Fresh install raspian ( ssh enable )
- update and upgrade
INSTALL FIREFOX-ESR
INSTALL GECKODRIVER- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-arm7hf.tar.gz
- tar -xvzf geckodriver-v*
- chmod +x geckodriver
- sudo cp geckodriver /usr/local/bin/
INSTALL INSTAPY ( last build ) and OTHER- pip3 install -I https://github.com/timgrossmann/InstaPy/zipball/master
- pip3 install future
- pip3 install pyvirtualdisplay
INSTALL XVFB ( NECESSARY IF USE CRON )- sudo apt-get install xvfb
For work:
xvfb-run python3 yourscript.pyEverything work without any modification
In the last build is already modified browser.py (hide selenium extension) and xpath_compile.pyCron is ok with xvfb
I think my old problem was with some python library but i'm unable to remove old library from os
Many than to everyone and may thanks to @Lisiadito
thanks , i'm now able to run it.
Sometimes just with some random instagram errors "Instagram error: The link you followed may be broken, or the page may have been removed..."
trying to figure it out what can be
That happens when a user changes the username. So it's normal and doesn't crash the Skript since it is expected.
That happens when a user changes the username. So it's normal and doesn't crash the Skript since it is expected.
thanks didn't knew that. btw, do you know any way to avoid the block on likes?
What are your settings for likes? Obviously there is some kind of limit per hour which is enforced by Instagram. But sometimes the script can verify if the like went through due to a timeout or something and then you get the occasional message that you might be blocked from liking.
session.set_user_interact(amount=2, randomize=True, percentage=60)
session.set_do_follow(enabled=True, percentage=40)
session.set_do_like(enabled=True, percentage=80)
# activity
session.like_by_tags(random.sample(like_tag_list, 3),
amount=random.randint(50, 100), interact=True)
I have it like this. It might be that, because when I got that block message at the script i'm still able to put likes on the app and at the browser
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Instagram just did a change again to the html (couple of minutes ago). The same way you can change to the following lines in xpath_compile.py
file:
xpath["like_image"] = {
"like": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Like']",
"unlike": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Unlike']",
}
Actually Instagram added one more html element 'span' after the last 'div'. Try to replace with the code above, it worked for me. Hopefully it'd work for you too :)
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Instagram just did a change again to the html (couple of minutes ago). The same way you can change to the following lines in
xpath_compile.py
file:xpath["like_image"] = { "like": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Unlike']", }
Actually Instagram added one more html element 'span' after the last 'div'. Try to replace with the code above, it worked for me. Hopefully it'd work for you too :)
I'm still getting the Invalid Like Element! Error after using that code above, not sure why. I'm using a Mac and I have version 0.6.9, using FireFox to run the script using Selenium. Any Ideas?
@alfanme 's solution is working for me, for now
Should we add try block to the xpath with several possible options?
@alfanme work perfect....
Many Thanks
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Instagram just did a change again to the html (couple of minutes ago). The same way you can change to the following lines in
xpath_compile.py
file:xpath["like_image"] = { "like": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Unlike']", }
Actually Instagram added one more html element 'span' after the last 'div'. Try to replace with the code above, it worked for me. Hopefully it'd work for you too :)
This one work for me too! Thanks
Could someone share how you find these paths? i tried with some extentions and use it in the code, it does'nt worked for me !
However Thank You @alfanme for the update! :heart_eyes:
Could someone share how you find these paths? i tried with some extentions and use it in the code, it does'nt worked for me !
However Thank You @alfanme for the update! 馃槏
Glad I can help you all guys.
Regarding @Aashiq-Otp request,
Here's the way how you check the path of like and unlike button.
how do we change the lines in the xpath file?
there is a open PR which should fix this problem. for now you can change these lines in the file
xpath_compile.py
xpath["like_image"] = { "like": "//section/span/button/div[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div[*[local-name()='svg']/@aria-label='Unlike']", }
Instagram just did a change again to the html (couple of minutes ago). The same way you can change to the following lines in
xpath_compile.py
file:xpath["like_image"] = { "like": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Like']", "unlike": "//section/span/button/div/span[*[local-name()='svg']/@aria-label='Unlike']", }
Actually Instagram added one more html element 'span' after the last 'div'. Try to replace with the code above, it worked for me. Hopefully it'd work for you too :)
I dont know why.. but this dont work for me...
I checked the HTML, and "span" was added, but despite editing and updating Instapy, it continues to give "Invalid like element".
Just updated to the newest version and it seems to work fine now.
I updated yesterday, and it worked.
But today I try to start the script, and again "Invalid Like Element".
I checked the html of the instagram page, everything is right... idk what is the problem!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this problem still occurs, please open a new issue
Most helpful comment
Instagram just did a change again to the html (couple of minutes ago). The same way you can change to the following lines in
xpath_compile.py
file:Actually Instagram added one more html element 'span' after the last 'div'. Try to replace with the code above, it worked for me. Hopefully it'd work for you too :)