mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 797 forks source link

getProfilePicFromId not working #399

Open erickmourasilva opened 6 years ago

erickmourasilva commented 6 years ago

Hello, after updating WhatsApp function getProfilePicFromId is no longer working, when debugging it the object returned contains the following error: Model: Name: "ModelCreateError" Stack: "ModelCreateError: t at t.n (https://web.whatsapp.com/app.1c6cccbeae5d099f4d1e.js:19:20325) at new t (https://web.whatsapp.com/app.1c6cccbeae5d099f4d1e.js:20:2887) at https://web.whatsapp.com/app.1c6cccbeae5d099f4d1e.js:9:31640 at x (https://web.whatsapp.com/app.1c6cccbeae5d099f4d1e.js:30:31007) at MutationObserver.I (https://web.whatsapp.com/app.1c6cccbeae5d099f4d1e.js:30:30499) "

not contain more elements imgFull, imgSmall or eurl

Any solution?

** EDIT **

I noticed that the function only works when there is a chat with the number consulted, if there is no chat it is not possible to consult more.

lfdelphino commented 6 years ago

Mine still returns eurl, img and imgFull when I do:

    window.Store.ProfilePicThumb.find("14078007750@c.us").then(function(d) {
        console.log(d);
    })

The only issue I have about this command is that sometimes whatsapp returns an image link even when the number doesn't have any photo so it tries to download and stays there "forever" trying until the 50000ms timeout exceeds

erickmourasilva commented 6 years ago

This happens when the number you requested has an image, but it is restricted to the contacts!

In my case is generated error in the store itself. Any solution guys?

lfdelphino commented 6 years ago

This happens when the number you requested has an image, but it is restricted to the contacts!

Would you suggest something about it? It happens everytime and doesn't even raise an error or something like that

not contain more elements imgFull, imgSmall or eurl

Were you using selenium remote or firefox when that happened?

erickmourasilva commented 6 years ago

You could try to handle the timeout and generate an exception.

I am using remote selenium with chrome.

lfdelphino commented 6 years ago

Did you try with firefox? There are a lot of things incompatible with chrome, and firefox is the default, that's why I stopped using it. Mozilla's Geckodriver

erickmourasilva commented 6 years ago

In both, the problem persists.

I noticed that the function only works when there is a chat with the number consulted, if there is no chat it is not possible to consult more.

tetradox commented 6 years ago

Is there a solution?

erm3nda commented 3 years ago

Following @lfdelphino comment, i've tried this.

window.Store.ProfilePicThumb.find("34657676760@c.us").then(function(d) { return(d['__x_imgFull']); })

And worked perfectly, so I can fill profile picture calling this on the serialize function, but still digging how to apply correctly ...

@erickmourasilva.

As far as i've understand, it's a whatsapp rule that you can't fetch picture untill you have chat with "contact". Once you did, you're able to fetch than info, even if you don't have a current chat open. This is a "protection" feature of whatsapp disabling people watching other people that might don't want. So, it's not a problem of the wapi.js at all.