just a humble request for code to like posts on the newsfeed to encorage interaction with people who we follow.
Another request would be to like pictures of the followings. The users that are followed from the base account just go one by one and like posts from specific timescare - like posts from 3 days ago. that would really come handy for many other feature addon.
I would like to take this task, I have already implemented this as a separate code and would love to see it integrated in your work.
https://gist.github.com/saurabh-kumar-vit/47537a54cf8b1a475ed72468b55b1e24
this is the code. It is written in base python with selenium. Can you guide me to how and where I should integrate it into your codebase.
I know that InstaPy already has functions for login and scrolling, so I would appreciate it if I can get some API guide for it.
@saurabh-kumar-vit Well, the InstaPy codeBase sadly isn't clean enough to add this in nicely...
It's probably easiest to add that to the instapy.py file, like like_by_location and like_by_tag
And then add a method get_links_for_feed like the get_links_for_tags and get_links_for_location methods in the like_util.py...
A refactor of the whole app is highly necessary...
@timgrossmann Ok, I will do it. Can you please assign this task to me.
@saurabh-kumar-vit Perfect!
I can't I'm only able to assign "Collaborators", which, at this point, you are not yet.
Any update on this? @saurabh-kumar-vit
Still working. I haven't been able to dedicate a lot of time on this but it should be ready by the end of the weekend. By the time you can use the gist script I linked earlier. It works independently from InstaPy.
@saurabh-kumar-vit I tried to run the gist but it doesnt work properly
It keeps scrolling but doesnt like anything from the feed
I think it has something to do with comment lines 34, 35, 41, 42 , 43 and 46
should I remove the pound to make them applicable?
Or do I have to make some changes to this? -
while True:
like_buttons = browser.find_elements_by_class_name('coreSpriteLikeHeartOpen')
flag = True
for button in like_buttons:
if button.text == 'Like':
try:
button.click()
total_likes += 1
last_like = time.time()
scroll_times = 0
except:
pass
time.sleep(LIKE_DELAY)
for some reason selenium is unable to find the like buttons. I need to check the tags again.
EDIT:
Instagram just updated the site and the class name is no longer valid, I will update the gist for you.
EDIT:
The gist has been updated
I have submitted a PR but it seems that I have made a mistake and it started as its own issue instead of showing up here, or maybe that is how it is supposed to happen. I apologize this is my first PR so I am not that comfortable with git and GitHub.
The issue ID of the PR is #345.
Do I need to submit the PR again?
Works wonders. Youre a legend for this.
I was also thinking about a feature to like posts of the users we follow..
Just like .like_feed and .like_by_locations can we have an extension for .like_by_followings to this feature bossman? and be able to like multiple posts from each user?
We definitely can have such a feature. As soon as my PR for this feature gets accepted I will start working on that feature.
Most helpful comment
I would like to take this task, I have already implemented this as a separate code and would love to see it integrated in your work.