Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i get phone numbers profile image and status? #26

Closed
zer0exploits opened this issue Oct 12, 2017 · 12 comments
Closed

How can i get phone numbers profile image and status? #26

zer0exploits opened this issue Oct 12, 2017 · 12 comments

Comments

@zer0exploits
Copy link

How can i get phone numbers profile image and status? Any function?

@zer0exploits
Copy link
Author

Please someone can do this?

@danielcardeenas
Copy link
Owner

danielcardeenas commented Nov 15, 2017

For getting profile picture

from app.mac import mac, signals

@signals.message_received.connect
def handle(message):
    # callback parameter optional
    def pp(who, path):
        print("Got profile", who, path)

    # preview parameter also optional
    mac.contact_picture(message.conversation, pp, preview=False)

    # if you want to specify the number:
    mac.contact_picture_from("521123456789" pp, preview=False)

@zer0exploits
Copy link
Author

def sago(message):
# callback parameter optional
def pp(who, path):
print("Got profile", who, path)
mac.contact_picture_from("90xxxxxxxxxxxxx", pp, preview=False)

Error:

File "/home/ubuntu/workspace/whatsapp-framework/app/mac/mac.py", line 191, in contact_picture_from
jid = Jid.normalize(phone_number)
NameError: name 'phone_number' is not defined
Whatsapp bot crashed with code 1. Respawning..

@zer0exploits
Copy link
Author

zer0exploits commented Nov 15, 2017

@danielcardeenas fix.
phone_number -> number

false:
def contact_picture_from(number, success_fn=None, preview=False):
jid = Jid.normalize(phone_number)
contact_picture(jid, success_fn, preview)

true:
def contact_picture_from(number, success_fn=None, preview=False):
jid = Jid.normalize(number)
contact_picture(jid, success_fn, preview)

@danielcardeenas
Copy link
Owner

Yeah i just fixed it. Please pull again

@danielcardeenas
Copy link
Owner

danielcardeenas commented Nov 15, 2017

To get statuses:

def ss(statuses):
    print(statuses)

mac.contact_status(message.who, ss)
mac.contact_status_from("5211234567890", ss)

Outputs:
{'5211234567890@s.whatsapp.net': ('My god is the sun', '1499591020')}

Also supports sending a list of contacts (normalized number jids or list of message.who)

@zer0exploits
Copy link
Author

Daniel can you please add one example to use this directly without chat bot.
Like when i run python status.py -> output directly {'5211234567890@s.whatsapp.net': ('My god is the sun', '1499591020')}

@danielcardeenas
Copy link
Owner

danielcardeenas commented Nov 15, 2017

I'm not sure what you mean.

@signals.initialized.connect
def connected(entity):
    def callback(status):
        print(status)

    mac.contact_status(message.who, callback)
    mac.contact_status_from("5211234567890", callback)

?

@zer0exploits
Copy link
Author

@danielcardeenas
I want one file, with login whatsapp, and after get number status. Not like whatsapp bot.
Example
python loginandgetstatus.py -> this file needs to login my whatsapp and get one numbers status.

@danielcardeenas
Copy link
Owner

Ah I understand. I need to rewrite mac as a library for this.

@zer0exploits
Copy link
Author

okey thank you for this amazing work. have a nice day.

@renatomedia
Copy link

@danielcardeenas how can I save the contact picture without bot conversation?
Example: python loginandgetpicture.py phone_number -> profile.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants