tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

Send media - Request upload for file XXXX@s.whatsapp.net failed [BOUNTY FOR SOLUTION] #2149

Open sealabr opened 7 years ago

sealabr commented 7 years ago

Hello I'm trying to upload media by yowsup, using RequestUploadIqProtocolEntity but it's not possible because lambda function allways direct to onRequestUploadError, and cant send file ...

Request upload for file /tmp/jpeg.jpg for 5524XXXXXXXX@s.whatsapp.net failed

I also tried with yowsupCLI using image send

/image send 5524XXXXXX /tmp/3DCDA9A9436B01F9A3.jfif

ERROR:yowsup.demos.cli.layer:Request upload for file /tmp/3DCDA9A9436B01F9A3.jfif for 5524XXXXXXX@s.whatsapp.net failed
DEBUG:yowsup.layers.logger.layer:rx:
<iq type="error" from="s.whatsapp.net" id="1">
<error text="feature-not-implemented" code="501">
</error>
mhuzqu commented 7 years ago

here the output:

't' 'r' 'u' 'e' Traceback (most recent call last):

Aragur commented 7 years ago

@mhuzqu Seems wired... Can you please compare it with the output from python3?

shekar3110a commented 7 years ago

@AragurDEV i tried your code and on python 3.6 am getting the error after uploading the file;

assert dimensions, "Could not determine image dimensions"

AssertionError: Could not determine image dimensions ERROR:yowsup.demos.cli.layer:Upload file sky_colors-wide copy.png to https://mmg.whatsapp.net/u/f/D0ySWW2HTXKeDFSgxfvPclm6eoIABVklr9YIKA/Auv38AmaNpCW38LsgI3h5RwLcn-uFBKMNC-NWuvE5S2f for 918147501447@s.whatsapp.net failed!

can you please help fix it ..

shekar

Ok now it worked after installing pillow sudo pip install -I pillow

suggestion from https://github.com/tgalal/yowsup/issues/577

Thanks a lot for the great work guys ...

Now just need to see how to send image from run.py and layer.py

mhuzqu commented 7 years ago

@AragurDEV yeah its wired..... with python3 the error is :

/yowsup-master/yowsup/structs/protocoltreenode.py", line 57 print repr(b) ^ SyntaxError: invalid syntax

hmmmmm

Aragur commented 7 years ago

@mhuzqu Yes because Python 3 replaces print with a function, so print(repr(b)) is needed.

shekar3110a commented 7 years ago

Hi

Can anybody help on how to add the SendImage function in the layer.py for implementing the send image on requesting in an interactive mode ..

for eg., user sends a message saying getimage and is should be in a position to call send_image function with file path and destination number/group

Would be really great if someone can help me on this..

Shekar

mhuzqu commented 7 years ago

@AragurDEV there's nothing in console after i put the print(repr(b)) but send message success. so, is the python2 have a bug.... or what?? i think, just used the python3 then close the issue.

mhuzqu commented 7 years ago

hii @shekar3110a you should find the method onMessage in demos/cli/layer.py, then try to call image_send method, you have to hardcoded the parameter required image_send method for testing purpose.

with above scenario, i have success to interactive with, then you should able to explore based on you need.

shekar3110a commented 7 years ago

Hi Mhuzqu

I managed to copy some function and try .. but it came through message sending and am getting error message sending failed here is my appended code;

def image_send(self, number, path, caption = None):
    self.media_send(number, path, RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE)

def media_send(self, number, path, mediaType, caption = None):
        jid = number
        entity = RequestUploadIqProtocolEntity(mediaType, filePath=path)
        successFn = lambda successEntity, originalEntity: self.onRequestUploadResult(jid, mediaType, path, successEntity, originalEntity, caption)
        errorFn = lambda errorEntity, originalEntity: self.onRequestUploadError(jid, path, errorEntity, originalEntity)
        self._sendIq(entity, successFn, errorFn)

def onRequestUploadResult(self, jid, mediaType, filePath, resultRequestUploadIqProtocolEntity, requestUploadIqProtocolEntity, caption = None):

    if resultRequestUploadIqProtocolEntity.isDuplicate():
        self.doSendMedia(mediaType, filePath, resultRequestUploadIqProtocolEntity.getUrl(), jid,
                         resultRequestUploadIqProtocolEntity.getIp(), caption)
    else:
        successFn = lambda filePath, jid, url: self.doSendMedia(mediaType, filePath, url, jid, resultRequestUploadIqProtocolEntity.getIp(), caption)
        mediaUploader = MediaUploader(jid, self.getOwnJid(), filePath,
                                  resultRequestUploadIqProtocolEntity.getUrl(),
                                  resultRequestUploadIqProtocolEntity.getResumeOffset(),
                                  successFn, self.onUploadError, self.onUploadProgress, async=False)
        mediaUploader.start()

def onRequestUploadError(self, jid, path, errorRequestUploadIqProtocolEntity, requestUploadIqProtocolEntity):
    print ("Request upload for file %s for %s failed" % (path, jid))

def onUploadError(self, filePath, jid, url):
    print ("Upload file %s to %s for %s failed!" % (filePath, url, jid))

def onUploadProgress(self, filePath, jid, url, progress):
    sys.stdout.write("%s => %s, %d%% \r" % (os.path.basename(filePath), jid, progress))
    sys.stdout.flush()

and am calling the function in the below way to send the image;

if message == 'hi': answer = "Hi "+namemitt+" " self.toLower(textmsg(answer, to = recipient )) print ( datetime.datetime.now()) print (answer) number = recipient path = "/Users/chandrashekar/Downloads/yowsup-master/ussdn.png" caption = "Testing"

            self.image_send( number, path, caption)

not sure what am i missing ..help would be appreciated

mhuzqu commented 7 years ago

@shekar3110a i just added the code below:

def onMessage(self, message): ..... self.output("Sent delivered receipt"+" and Read" if self.sendRead else "", tag = "Message %s" % message.getId())

send testing image_send

        self.image_send("xxnumberxx", "/opt/img.jpg", "test")

should work....

shekar3110a commented 7 years ago

@mhuzqu

am getting error

File "/Users/chandrashekar/Downloads/yowsup-master/layer.py", line 136, in onTextMessage self.output("Sent delivered receipt"+" and Read" if self.sendRead else "", tag = "Message %s" % message.getId()) AttributeError: 'EchoLayer' object has no attribute 'output' Exception ignored in: <layer.Logger object at 0x103a846a0> AttributeError: 'Logger' object has no attribute 'flush'

mhuzqu commented 7 years ago

@shekar3110a you miss something, try to get all source code from @AragurDEV here : https://github.com/AragurDEV/yowsup/blob/master/yowsup

use python3, install pillow, compile yowsup, then run your yowsup

pedritopy commented 7 years ago

hello, i have used this repository: https://github.com/dietzi/yowsup, i can send images to any contact, but on receiving i download the picture but i can not see it is as if it was corrupt.

langioletto commented 7 years ago

This is the patch to send geolocation after the changes for sending images (enc)

@AragurDEV you can add this edit to your fork

diff: https://pastebin.com/GFhkDkYW

shekar3110a commented 7 years ago

@mhuzqu

I have done all those and successfully sent the picture message for both single and group using yawsup-cli

now am trying to integrate with independent application where i can reply with image for certain string when user sends me the message.

Shekar

langioletto commented 7 years ago

@shekar3110a look here

https://github.com/tgalal/yowsup/issues/1648#issuecomment-226345506

shekar3110a commented 7 years ago

Dear @langioletto , @mhuzqu and all the guys who made this happen to send the image .. finally got my script working ...

the problem was on the Upload progress

Changed from : def onUploadProgress(self, filePath, jid, url, progress): sys.stdout.write("%s => %s, %d%% \r" % (os.path.basename(filePath), jid, progress)) sys.stdout.flush()

To: def onUploadProgress(self, filePath, jid, url, progress): print("%s => %s, %d%% \r" % (os.path.basename(filePath), jid, progress))

sys.stdout.flush()

it worked like a charm .. will try and fine tune the complete and upload it later ..

Thanks once again guys ..

Shekar

Aragur commented 7 years ago

@langioletto Thanks for your diff, I will look into it and add it to my fork asap.


@mhuzqu Yes Python2 is acting wired. Maybe we should only support Python3 in the future, why bother with an old version?


@shekar3110a I'm glad you got your script working. But maybe next time try to make an own issue or join my (newly created) discord channel for Yowsup support https://discord.gg/Wa7QSxZ

shekar3110a commented 7 years ago

@AragurDEV

Sure, However, am not a core developer, just an amateur guy who likes some excited things and try and put different codes from great developer and try and build something they way I need.. Just started with Python only after downloading yowsup.. but happy to help where possible and share what i have learnt in the process

shekar

jcchua commented 7 years ago

I am using fork from @dietzi and tested sending image is working but how do I deal with receive photo and save it to a folder?

langioletto commented 7 years ago

@jcchua look here

https://github.com/tgalal/yowsup/issues/1648#issuecomment-226345506

danielcardeenas commented 7 years ago

You guys did a really good job here. Thanks

shekar3110a commented 7 years ago

Hi All,

First of all i would like to Than @tgalal and @AragurDEV ++ all those members who were involved in making this Yowsup happen.

Secondly, i would like to thank all those guys whose scripts i had taken from various sources in the net to put to gather a server application where i could build the bot kind of stuff along with HTTP server for sending the alerts and stuff.

please find the scripts in the https://pastebin.com/wY5ehF8j

Please feel free to take the script and customise it to your needs

mhuzqu commented 7 years ago

@shekar3110a great then, try to modify Yowsup as you need. i am newbie in python too, my primary programming language is Java. you link is useful..... great

@AragurDEV yes, that what i mean, someone should update the readme.md and put the PYTHON3 as requirement.

Aragur commented 7 years ago

@mhuzqu Make a pull request on my repo

mhuzqu commented 7 years ago

@AragurDEV great...

langioletto commented 7 years ago

Hi everyone, meanwhile we thought that we could solve the issue of sending broadcast?

/message broadcast 40xxxxxxxxx,40xxxxxxxxx"Ciao"

[connected]:Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/EGG-INFO/scripts/yowsup-cli", line 368, in if not parser.process(): File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/EGG-INFO/scripts/yowsup-cli", line 268, in process self.startCmdline() File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/EGG-INFO/scripts/yowsup-cli", line 297, in startCmdline stack.start() File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/demos/cli/stack.py", line 26, in start self.stack.loop(timeout = 0.5, discrete = 0.5) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/stacks/yowstack.py", line 188, in loop asyncore.loop(*args, **kwargs) File "/usr/lib/python2.7/asyncore.py", line 216, in loop poll_fun(timeout, map) File "/usr/lib/python2.7/asyncore.py", line 156, in poll read(obj) File "/usr/lib/python2.7/asyncore.py", line 87, in read obj.handle_error() File "/usr/lib/python2.7/asyncore.py", line 83, in read obj.handle_read_event() File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event self.handle_read() File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/network/layer.py", line 102, in handle_read self.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/network/layer.py", line 110, in receive self.toUpper(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 29, in receive self.processReceived() File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived self.toUpper(oneMessageData) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/auth/layer_crypt.py", line 65, in receive self.toUpper(payload) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/coder/layer.py", line 35, in receive self.toUpper(node) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/logger/layer.py", line 14, in receive self.toUpper(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_control.py", line 44, in receive self.toUpper(protocolTreeNode) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init__.py", line 194, in receive s.receive(data) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_send.py", line 118, in receive if not self.processIqRegistry(protocolTreeNode): File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/init__.py", line 163, in processIqRegistry errorClbk(protocolTreeNode, originalIq) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_base.py", line 81, in onError errorClbk(errorNode, getKeysEntity) TypeError: () takes no arguments (2 given)

mhuzqu commented 7 years ago

@langioletto try to use python3, not python2

langioletto commented 7 years ago

[connected]:/message broadcast 39xxxxxxxxxxxxx,39xxxxxxxxxxxxx "Ciao"

[connected]:Traceback (most recent call last): File "/usr/local/bin/yowsup-cli", line 4, in import('pkg_resources').run_script('yowsup2==2.5.2', 'yowsup-cli') File "/usr/lib/python3/dist-packages/pkg_resources.py", line 534, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1438, in run_script execfile(script_filename, namespace, namespace) File "/usr/lib/python3/dist-packages/pkg_resources.py", line 59, in execfile exec(compile(open(fn).read(), fn, 'exec'), globs, locs) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/EGG-INFO/scripts/yowsup-cli", line 368, in if not parser.process(): File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/EGG-INFO/scripts/yowsup-cli", line 268, in process self.startCmdline() File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/EGG-INFO/scripts/yowsup-cli", line 297, in startCmdline stack.start() File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/demos/cli/stack.py", line 26, in start self.stack.loop(timeout = 0.5, discrete = 0.5) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/stacks/yowstack.py", line 188, in loop asyncore.loop(*args, **kwargs) File "/usr/lib/python3.4/asyncore.py", line 208, in loop poll_fun(timeout, map) File "/usr/lib/python3.4/asyncore.py", line 153, in poll read(obj) File "/usr/lib/python3.4/asyncore.py", line 87, in read obj.handle_error() File "/usr/lib/python3.4/asyncore.py", line 83, in read obj.handle_read_event() File "/usr/lib/python3.4/asyncore.py", line 442, in handle_read_event self.handle_read() File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/network/layer.py", line 102, in handle_read self.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/network/layer.py", line 110, in receive self.toUpper(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/stanzaregulator/layer.py", line 29, in receive self.processReceived() File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived self.toUpper(oneMessageData) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/auth/layer_crypt.py", line 65, in receive self.toUpper(payload) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/coder/layer.py", line 35, in receive self.toUpper(node) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/logger/layer.py", line 14, in receive self.toUpper(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_control.py", line 44, in receive self.toUpper(protocolTreeNode) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init__.py", line 194, in receive s.receive(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_send.py", line 118, in receive if not self.processIqRegistry(protocolTreeNode): File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init__.py", line 163, in processIqRegistry errorClbk(protocolTreeNode, originalIq) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_base.py", line 81, in onError errorClbk(errorNode, getKeysEntity) TypeError: () takes 0 positional arguments but 2 were given

pabloruan0710 commented 7 years ago

@langioletto try changes in yowsup/layers/axolotl/layer_base.py", line 81:

remove this:

errorClbk(errorNode, getKeysEntity)

for this:

errorClbk()

langioletto commented 7 years ago

Now no error, but the recipient receives nothing

[connected]:
/message broadcast 39xxxxxxxxxx,39xxxxxxxxxx Ciao
[connected]:Iq:
ID: 14
Type: result
from: 39xxxxxxxxxx@s.whatsapp.net
langioletto commented 7 years ago

Send it via boot

destinations=["39xxxxxxxxx", "39xxxxxxxxx"] self.toLower(textmsg(answer, to = destinations ))

+ python3 /root/.yowsup/run.py
root@raspberrypi:~# Traceback (most recent call last):
  File "/root/.yowsup/run.py", line 30, in <module>
    stack.loop( timeout = 0.5, discrete = 0.5 )                                       #this is the program mainloop
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/stacks/yowstack.py", line 188, in loop
    asyncore.loop(*args, **kwargs)
  File "/usr/lib/python3.4/asyncore.py", line 208, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python3.4/asyncore.py", line 153, in poll
    read(obj)
  File "/usr/lib/python3.4/asyncore.py", line 87, in read
    obj.handle_error()
  File "/usr/lib/python3.4/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib/python3.4/asyncore.py", line 442, in handle_read_event
    self.handle_read()
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/network/layer.py", line 102, in handle_read
    self.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/network/layer.py", line 110, in receive
    self.toUpper(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/stanzaregulator/layer.py", line 29, in receive
    self.processReceived()
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived
    self.toUpper(oneMessageData)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/auth/layer_crypt.py", line 65, in receive
    self.toUpper(payload)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/coder/layer.py", line 35, in receive
    self.toUpper(node)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/logger/layer.py", line 14, in receive
    self.toUpper(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_control.py", line 44, in receive
    self.toUpper(protocolTreeNode)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 194, in receive
    s.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 41, in receive
    self.onMessage(protocolTreeNode)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 74, in onMessage
    self.handleEncMessage(protocolTreeNode)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 88, in handleEncMessage
    self.handleWhisperMessage(node)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 151, in handleWhisperMessage
    self.parseAndHandleMessageProto(encMessageProtocolEntity, plaintext[:-padding])
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 195, in parseAndHandleMessageProto
    self.handleConversationMessage(node, m.conversation)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_receive.py", line 224, in handleConversationMessage
    self.toUpper(messageNode)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 194, in receive
    s.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 130, in receive
    recv(node)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/protocol_messages/layer.py", line 21, in recvMessageStanza
    self.toUpper(entity)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/interface/interface.py", line 80, in receive
    self.entity_callbacks[entityType](entity)
  File "/root/.yowsup/layer.py", line 80, in onMessage
    self.onTextMessage(messageProtocolEntity) #Send the answer
  File "/root/.yowsup/layer.py", line 196, in onTextMessage
    self.toLower(textmsg(answer, to = destinations ))
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 84, in toLower
    self.__lower.send(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 198, in send
    s.send(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 136, in send
    send(entity)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/protocol_messages/layer.py", line 15, in sendMessageEntity
    self.entityToLower(entity)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 140, in entityToLower
    self.toLower(entity.toProtocolTreeNode())
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 84, in toLower
    self.__lower.send(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/__init__.py", line 198, in send
    s.send(data)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_send.py", line 100, in send
    self.processPlaintextNodeAndSend(node)
  File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_send.py", line 141, in processPlaintextNodeAndSend
    recipient_id = node["to"].split('@')[0]
AttributeError: 'list' object has no attribute 'split'
Aragur commented 7 years ago

@pabloruan0710 You are only "fixing" the error handling. Broadcast messages are still failing. WhatsApp retunrs following iq:

<iq type="error" id="2" from="s.whatsapp.net">
    <error code="406" text="not-acceptable">
    </error>
</iq>
langioletto commented 7 years ago

@shekar3110a

Look here v10, thank you

althafas commented 7 years ago

ERROR:yowsup.demos.cli.layer:Request upload for file cat.jpg for 919XXXXXXXXXX@s.whatsapp.net failed DEBUG:yowsup.layers.logger.layer:rx: < iq from="s.whatsapp.net" id="3" type="error" > < error text="feature-not-implemented" code="501" > < /error > < /iq >

Any help?

jinnkhan88 commented 7 years ago

Hi guys, Can we send videos with these changes? As i am trying to send a video .mp4 format i am getting the following error

ERROR:yowsup.layers.protocol_media.mediauploader:Error occured at transfer 'NoneType' object has no attribute 'setAttribute' Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/protocol_media/mediauploader.py", line 198, in run self.successCallback(sourcePath, self.jid, result) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/demos/cli/layer.py", line 762, in <lambda> successFn = lambda filePath, jid, url: self.doSendMedia(mediaType, filePath, url, jid, resultRequestUploadIqProtocolEntity.getIp(), caption) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/demos/cli/layer.py", line 749, in doSendMedia self.toLower(entity) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 84, in toLower self.__lower.send(data) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 198, in send s.send(data) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 136, in send send(entity) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/protocol_media/layer.py", line 35, in sendMessageEntity self.entityToLower(entity) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 140, in entityToLower self.toLower(entity.toProtocolTreeNode()) File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py", line 84, in toProtocolTreeNode mediaNode.setAttribute("encoding", self.encoding) AttributeError: 'NoneType' object has no attribute 'setAttribute'

However I also tried installing ffvideo on my mac. However no luck. Can anyone help me in this regard?

drashtived commented 7 years ago

Hi all,

I am using Aragur's fork. However, I recieve the following error with trying to send an image

Error occured at transfer bytearray index out of range Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/protocol_media/mediauploader.py", line 200, in run self.successCallback(sourcePath, self.jid, result) File "/home/parag/WhatsappClient/src/ImageLayer.py", line 37, in onUploadSuccess self.toLower(entity) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 198, in send s.send(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init__.py", line 136, in send send(entity) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/protocol_media/layer.py", line 35, in sendMessageEntity self.entityToLower(entity) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 140, in entityToLower self.toLower(entity.toProtocolTreeNode()) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/init.py", line 198, in send s.send(data) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_send.py", line 113, in send self.handleEncNode(node) File "/usr/local/lib/python3.4/dist-packages/yowsup2-2.5.2-py3.4.egg/yowsup/layers/axolotl/layer_send.py", line 73, in handleEncNode ciphertext = sessionCipher.encrypt(messageData) File "/usr/local/lib/python3.4/dist-packages/python_axolotl-0.1.39-py3.4.egg/axolotl/sessioncipher.py", line 49, in encrypt senderEphemeral = sessionState.getSenderRatchetKey() File "/usr/local/lib/python3.4/dist-packages/python_axolotl-0.1.39-py3.4.egg/axolotl/state/sessionstate.py", line 66, in getSenderRatchetKey return Curve.decodePoint(bytearray(self.sessionStructure.senderChain.senderRatchetKey), 0) File "/usr/local/lib/python3.4/dist-packages/python_axolotl-0.1.39-py3.4.egg/axolotl/ecc/curve.py", line 34, in decodePoint type = _bytes[0] # byte appears to be automatically converted to an integer?? IndexError: bytearray index out of range Upload file failed!/home/parag/WhatsappClient/src/image.jpg 919975172622 https://mmg.whatsapp.net/u/f/eXWecrAdfqeNVLH6lS06XFnBC1sABVmJ35AGLQ/AibQjuvZED-MhwvRGDJrhADq2rm6O9ZgRWDLADa0So

I tried switching to Python 3 as well. Anyone who faced and solved the same please help!

langioletto commented 7 years ago

Use fork @AragurDEV

drashtived commented 7 years ago

I am using his fork. Still getting this error

jinnkhan88 commented 7 years ago

@AragurDEV can you help me in sending the video?

langioletto commented 7 years ago

that fork does not have the patch

Aragur commented 7 years ago

Yes it doesn't have it. But together we can achieve it.

langioletto commented 7 years ago

together we can fix the broadcast

fmachadodev-zz commented 7 years ago

@drashtived To fixe this error

> type = _bytes[0] # byte appears to be automatically converted to an integer??
> IndexError: bytearray index out of range
> Upload file failed!/home/parag/WhatsappClient/src/image.jpg 919975172622

You need to add this in handleEncNode method inside yowsup/layers/axolotl/layer_send.py file on line 70

if not self.store.containsSession(recipient_id,1):
                    self.getKeysFor([node["to"]], lambda successJids, b: self.sendToContact(node) if len(successJids) == 1 else self.toLower(node), la
mbda: self.toLower(node))

It is just an key exchange problem.

PS: I'm using AragurDEV (https://github.com/AragurDEV/yowsup/) rep.

mcubillos commented 7 years ago

Hi can anybody help me with this error ?? serialized_pb=_b('\n\x08wa.proto\x12\x12\x63om.whatsapp.proto\"\x95\x04\n\x07Message\x12\x14\n\x0c\x63onversation\x18\x01 \x01(\t\x12Y\n\x1fsender_key_distribution_message\x18\x02 \x01(\x0b\x32\x30.com.whatsapp.proto.SenderKeyDistributionMessage\x12\x37\n\rimage_message\x18\x03 \x01(\x0b\x32 .com.whatsapp.proto.ImageMessage\x12;\n\x0f\x63ontact_message\x18\x04 \x01(\x0b\x32\".com.whatsapp.proto.ContactMessage\x12=\n\x10location_message\x18\x05 \x01(\x0b\x32#.com.whatsapp.proto.LocationMessage\x12=\n\x10\x64ocument_message\x18\x07 \x01(\x0b\x32#.com.whatsapp.proto.DocumentMessage\x12\x33\n\x0burl_message\x18\x06 \x01(\x0b\x32\x1e.com.whatsapp.proto.UrlMessage\x12\x37\n\raudio_message\x18\x08 \x01(\x0b\x32 .com.whatsapp.proto.AudioMessage\x12\x37\n\rvideo_message\x18\t \x01(\x0b\x32 .com.whatsapp.proto.VideoMessage\"`\n\x1cSenderKeyDistributionMessage\x12\x0f\n\x07groupId\x18\x01 \x02(\t\x12/\n\'axolotl_sender_key_distribution_message\x18\x02 \x02(\x0c\"\xb3\x01\n\x0cImageMessage\x12\x0b\n\x03url\x18\x01 \x02(\x0c\x12\x11\n\tmime_type\x18\x02 \x02(\t\x12\x0f\n\x07\x63\x61ption\x18\x03 \x02(\t\x12\x13\n\x0b\x66ile_sha256\x18\x04 \x02(\x0c\x12\x13\n\x0b\x66ile_length\x18\x05 \x02(\x04\x12\x0e\n\x06height\x18\x06 \x02(\r\x12\r\n\x05width\x18\x07 \x02(\r\x12\x11\n\tmedia_key\x18\x08 \x02(\x0c\x12\x13\n\x0b\x66ile_enc_sha256\x18\x09 \x02(\x0c\x12\x16\n\x0ejpeg_thumbnail\x18\x10 \x02(\x0c\"\xa6\x01\n\x0cVideoMessage\x12\x0b\n\x03url\x18\x01 \x02(\x0c\x12\x11\n\tmime_type\x18\x02 \x02(\t\x12\x13\n\x0b\x66ile_sha256\x18\x03 \x02(\x0c\x12\x13\n\x0b\x66ile_length\x18\x04 \x02(\x04\x12\x10\n\x08\x64uration\x18\x05 \x02(\x04\x12\x11\n\tmedia_key\x18\x06 \x02(\x0c\x12\x0f\n\x07\x63\x61ption\x18\x07 \x02(\t\x12\x16\n\x0ejpeg_thumbnail\x18\x10 \x02(\x0c\"\x8a\x01\n\x0c\x41udioMessage\x12\x0b\n\x03url\x18\x01 \x02(\x0c\x12\x11\n\tmime_type\x18\x02 \x02(\t\x12\x13\n\x0b\x66ile_sha256\x18\x03 \x02(\x0c\x12\x13\n\x0b\x66ile_length\x18\x04 \x02(\x04\x12\x10\n\x08\x64uration\x18\x05 \x02(\x04\x12\x0b\n\x03unk\x18\x06 \x02(\r\x12\x11\n\tmedia_key\x18\x07 \x02(\x0c\"\x8a\x01\n\x0fLocationMessage\x12\x18\n\x10\x64\x65grees_latitude\x18\x01 \x02(\x01\x12\x19\n\x11\x64\x65grees_longitude\x18\x02 \x02(\x01\x12\x0c\n\x04name\x18\x03 \x02(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x04 \x02(\t\x12\x0b\n\x03url\x18\x05 \x02(\t\x12\x16\n\x0ejpeg_thumbnail\x18\x10 \x02(\x0c\"\xa9\x01\n\x0f\x44ocumentMessage\x12\x0b\n\x03url\x18\x01 \x02(\t\x12\x11\n\tmime_type\x18\x02 \x02(\t\x12\r\n\x05title\x18\x03 \x02(\t\x12\x13\n\x0b\x66ile_sha256\x18\x04 \x02(\x0c\x12\x13\n\x0b\x66ile_length\x18\x05 \x02(\x04\x12\x12\n\npage_count\x18\x06 \x02(\r\x12\x11\n\tmedia_key\x18\x07 \x02(\x0c\x12\x16\n\x0ejpeg_thumbnail\x18\x10 \x02(\x0c\"\x83\x01\n\nUrlMessage\x12\x0c\n\x04text\x18\x01 \x02(\t\x12\x14\n\x0cmatched_text\x18\x02 \x02(\t\x12\x15\n\rcanonical_url\x18\x04 \x02(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x02(\t\x12\r\n\x05title\x18\x06 \x02(\t\x12\x16\n\x0ejpeg_thumbnail\x18\x10 \x02(\x0c\"5\n\x0e\x43ontactMessage\x12\x14\n\x0c\x64isplay_name\x18\x01 \x02(\t\x12\r\n\x05vcard\x18\x10 \x02(\x0c') File "/home/maria/Documentos/whatstelegram/venv/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 829, in new return _message.default_pool.AddSerializedFile(serialized_pb) TypeError: Couldn't parse file content!

jinnkhan88 commented 7 years ago

I was able to send video by doing some changes however it says "Download Failed" the download was unable to complete please try again later. Any help?

Aragur commented 7 years ago

This is caused by a encryption key mismatch

drashtived commented 7 years ago

@AragurDEV @fmachadodev thanks a ton!! I am now able to send image . It still throws error but the image goes through

Aragur commented 7 years ago

Can you please paste your error on Pastebin?

drashtived commented 7 years ago

https://pastebin.com/8XHL1ha8