Sunday, November 2, 2014

Using Yowsup to send audio and video

It works.

Sending audio and video files work in the same way as sending images. It begins with a call to media_requestUpload with the hash, a string of the type of file to upload, and the filesize as arguments, and once the request succeeds, the client has to use MediaUploader to upload the local file, and finally when the upload completes the client can then send the URL to friends using the method message_imageSend, message_audioSend, and message_videoSend for images, audio files and video files respectively. The only difference in the API for these 3 methods are: message_audioSend does not have a preview as argument, while message_videoSend and message_imageSend both have a argument for the preview (which can be None).

Please note that most of the audio and video uploader code is copy-pasted from the image uploader, and I haven't wrote in preview code for the video uploader due to the infinite variety of video formats out there. This code is more for people to look at and see how it works than to be used in production.

Examples\VideoUploaderClient.py
yowsup-cli

Tested with .mp3 and .wav for audio, and .mp4 for video.

Using Yowsup to send audio and video files

9 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Just getting:

    Sending picture 3146.jpg of size 310914 with name 3146.jpg
    Sending media_requestUpload
    Request Fail: hash: Wupcov2VxdVmkYdyol+nJjZfd9ChIlTrwZcUJ+bf8OM=

    How to fix that? :D

    ReplyDelete
    Replies
    1. What's the command that you're using?

      Delete
    2. cd /whatsfap/ && ./yowsup-cli --config fap.conf --sendAudio 49151xxxxxxxx /www/whatsfap/audios/franz.mp3 -a

      cd /whatsfap/ && ./yowsup-cli --config fap.conf --sendImage 49151xxxxxxxx /www/whatsfap/images/1.jpg -a

      Delete
  3. I've made a large post about the problem. Can you check out this?

    https://github.com/tgalal/yowsup/issues/332

    ReplyDelete
  4. I am getting success URL but the image is not delivered . any luck ?

    ReplyDelete
  5. can u plz help me with the steps to be followed for above code

    ReplyDelete