Instapy: Follow likers function can't fetch likers properly

Created on 13 Dec 2018  ·  23Comments  ·  Source: timgrossmann/InstaPy

Getting likers from user: targetuser1

shuffling links
Got 24 , returning 1 links: ['https://www.instagram.com/p/{postId}/']
Few likes, not guaranteed you don't follow these likers already.
Got photo likers: ['', 'username12315', '3,742 others']

Earlier today everything was alright. I run it now and it's this way.
@timgrossmann

Most helpful comment

Hi @opexa
I saw your problem while reading @timgrossmann's thread.

It is a problem out of the existing design off a commit - f31dc3f1ef3b79df670426113474dbb32aba6406 from @pez5001 introducing the usage of the re module in there (_15 days ago_).

if re.match(r'\d+ others', liked_this[-1].text):

That line fails when a button's text is 13,742 others.

Why?
Cos \d+ matches the decimals [0-9] but not with a comma.

I have normalized it and shared a solution at my live PR- #3460.
To apply it manually, see 49fd6e7c57691c25e92bd8ad819f5c0ff162f05a commit.

If you find it hard to apply, just open up commenters_util.py file and,
replace,

if re.match(r'\d+ others', liked_this[-1].text): 

with

if " others" in liked_this[-1].text: 

that's it.

Other changes in that commit are good but not crucial.


Cheers 😁

All 23 comments

same issue.

same here:


Few likes, not guaranteed you don't follow these likers already.
Got photo likers: ['', 'bobbyjt88', '1,661 others']

INFO [2018-12-14 08:39:10] [X] Failed to get followers count of 'b'1,661 others'' ~empty list
INFO [2018-12-14 08:40:01] [X] Failed to get following count of 'b'1,661 others'' ~empty list
INFO [2018-12-14 08:40:01] [X] User: '1,661 others' |> followers: unknown |> following: unknown |> relationship ratio: unknown
ERROR [2018-12-14 08:40:04] [X] ~cannot get number of posts for username
INFO [2018-12-14 08:40:04] [X] --> Not a valid user: ---> Sorry, couldn't check for number of posts of username

INFO [2018-12-14 08:41:07] [X] Failed to get followers count of 'b''' ~empty list
INFO [2018-12-14 08:42:02] [X] Failed to get following count of 'b''' ~empty list
INFO [2018-12-14 08:42:02] [X] User: '' |> followers: unknown |> following: unknown |> relationship ratio: unknown
ERROR [2018-12-14 08:42:13] [X] ~cannot get number of posts for username
INFO [2018-12-14 08:42:13] [X] --> Not a valid user: ---> Sorry, couldn't check for number of posts of username

INFO [2018-12-14 08:42:13] [X] ---> bobbyjt88 has already been followed 1 times

Few likes, not guaranteed you don't follow these likers already.
Got photo likers: ['', 'this_lad', '1,487 others']


How to solve this?

Same :(

Hello. It's been two days since I have this problem. can someone help me ?

INFO [2018-12-14 12:53:43] [xavierledo_coach] Starting to follow likers..
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Getting likers from user: marinlle

shuffling links
Got 24 , returning 6 links: ['https://www.instagram.com/p/BrUfzqyFHH5/', 'https://www.instagram.com/p/BrIgCxjFgK-/', 'https://www.instagram.com/p/BqjiY5hlTV_/', 'https://www.instagram.com/p/BqnR7ABF0q3/', 'https://www.instagram.com/p/Bqu2ZNiF9L1/', 'https://www.instagram.com/p/Bq9YHAzlCLe/']
Few likes, not guaranteed you don't follow these likers already.
Got photo likers: ['cyrilcoach', '17,208 others']

INFO [2018-12-14 12:55:00] [xavierledo_coach] Failed to get followers count of 'b'17,208 others'' ~empty list

Same here

Same in here, hopefully someone can solve this problem.

someone ?

@opexa

@erdemnohutcu

@JoeFertig

@michaellafrasse

@XavierRaul

@theJacobDev

@timgrossmann

Yes, I notice this issue as well.

Hi @opexa
I saw your problem while reading @timgrossmann's thread.

It is a problem out of the existing design off a commit - f31dc3f1ef3b79df670426113474dbb32aba6406 from @pez5001 introducing the usage of the re module in there (_15 days ago_).

if re.match(r'\d+ others', liked_this[-1].text):

That line fails when a button's text is 13,742 others.

Why?
Cos \d+ matches the decimals [0-9] but not with a comma.

I have normalized it and shared a solution at my live PR- #3460.
To apply it manually, see 49fd6e7c57691c25e92bd8ad819f5c0ff162f05a commit.

If you find it hard to apply, just open up commenters_util.py file and,
replace,

if re.match(r'\d+ others', liked_this[-1].text): 

with

if " others" in liked_this[-1].text: 

that's it.

Other changes in that commit are good but not crucial.


Cheers 😁

Traceback (most recent call last):
File "followerd.py", line 3, in
from instapy import InstaPy
File "/Users/erdemnohutcu/InstaPy/instapy/__init__.py", line 3, in
from .instapy import InstaPy
File "/Users/erdemnohutcu/InstaPy/instapy/instapy.py", line 60, in
from .commenters_util import extract_information
File "/Users/erdemnohutcu/InstaPy/instapy/commenters_util.py", line 67
print ("loading more comments.")
^
IndentationError: unexpected indent

After this i got this error

@erdemnohutcu
Python has strict rules on indentation. Make sure you have it set properly.
If you can't solve that indentation issue, upload that file here [in a zip], I will help, hopefully.

I have tested it and it works. Thanks for the fix.

Thanks @uluQulu , you are amazing

Hey there I changed the crucial parts but still get the same error.

> ('\nGetting likers from user: ', 'bbcearth', '\n')
> ('Got ', 12, ', returning ', 3, ' links: ', ...)
> Video has no likes?
> Moving on..

I haven't found

if re.match(r'\d+ others', liked_this[-1].text):

in my commenter_util.py, so these are my current lines:

`def likers_from_photo(browser, amount=20):

user_liked_list = []
try:
    liked_this = browser.find_elements_by_xpath("//div/article/div[2]/section[2]/div/a")
    likers = []
    for liker in liked_this:
        if "like this" not in liker.text:
            likers.append(liker.text)        
    if check_exists_by_xpath(browser, "//div/article/div[2]/section[2]/div/a"):
        if " others" in liked_this[-1].text:
            element_to_click = liked_this[-1]

        elif " likes" in liked_this[0].text:
            element_to_click = liked_this[0]

    else:
        print ("Video has no likes?")
        print ("Moving on..")
        return []

    sleep(1)
    click_element(browser, liked_this[0])
    print ("opening likes")
    # update server calls
    #update_activity()    `

Any ideas?

Hi @unipython

I haven't found
if re.match(r'\d+ others', liked_this[-1].text):

You have not found it cos you have a quite old copy of InstaPy cos that line above was introduced 15 days before I suggested a change on it.
That 15 days ago, there were other fixes, too, which targeted some problems with video medias and you probably face those problems.

If you just pull upstream master, I think you will not have any problems.
And yes, the fix I wrote at this thread is now _merged_ and you don't need to apply it manually.


Cheers 😁

Check for updates before issuing a problem

Hi there,

thanks a lot for your quick response, but how do I pull upstream master? Sorry quite new to this.


From: Şəhriyar Cəfər Qulu notifications@github.com
Sent: 23 December 2018 14:39
To: timgrossmann/InstaPy
Cc: unipython; Mention
Subject: Re: [timgrossmann/InstaPy] Follow likers function can't fetch likers properly (#3573)

Hi @unipythonhttps://github.com/unipython

I haven't found
if re.match(r'd+ others', liked_this[-1].text):

You have not found it cos you have a quite old copy of InstaPy cos that line above was introduced 15 days before I suggested a change on it.
That 15 days ago, there were other fixes, too, which targeted some problems with video medias and you probably face those problems.

If you just pull upstream master, I think you will not have any problems.
And yes, the fix I wrote at this thread is now merged and you don't need to apply it manually.


Cheers 😁

Check for updates before issuing a problem


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/timgrossmann/InstaPy/issues/3573#issuecomment-449637080, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ArCcjLnCDGZn2F0dUe7n7JonjkkA4ctLks5u74ekgaJpZM4ZSa1w.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seuraltimez picture seuraltimez  ·  3Comments

CharlesCCC picture CharlesCCC  ·  3Comments

deronsizemore picture deronsizemore  ·  3Comments

ingorichter picture ingorichter  ·  3Comments

Spyd3r0us picture Spyd3r0us  ·  3Comments