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

random video upload issue #714

Open erickythierry opened 4 years ago

erickythierry commented 4 years ago

Hello everyone, I would like to ask for help. I have a bot only in python that uploads mp4 videos downloaded from YouTube, but it is not always possible to upload, even if the video is small (less than 40mb), at the bot terminal thousands of random characters appear at the moment the video tries to be uploaded. someone with the same problem? I am using send media function.

lfdelphino commented 4 years ago

WhatsApp is not meant for heavy videos, can you send a link to your users so they can download 30mb+ videos?

erickythierry commented 4 years ago

WhatsApp is not meant for heavy videos, can you send a link to your users so they can download 30mb+ videos?

I understand your logic, but I am creating this bot just to provide for users who do not have free access to the Internet. In my country, mobile operators provide unlimited whatsapp on various prepaid plans even after finishing the internet franchise, so I would like to use whatsapp's ability to upload files up to 100mb in size to provide the videos to these users.

lfdelphino commented 4 years ago

Awesome idea, I'm from Brazil aswell, I hope you can share your bot with us when it's done :D

I'll test sending large files today and edit here if I find something useful

erickythierry commented 4 years ago

Awesome idea, I'm from Brazil aswell, I hope you can share your bot with us when it's done :D

I'll test sending large files today and edit here if I find something useful OFF você é brasileiro? kkk é falando comigo em inglês kkk enfim. tô com um bot já pronto que extrai o mp3 dos vídeos e envia pro usuário pelo whatsapp, e assim está funcionando muito bem, sem problemas, porém eu agora queria enviar vídeos também. porém sem sucesso. única forma que consegui enviar vídeos foi usando um método mais arcaico de enviar, usando selenium webdriver puro e fazendo ele interagir com a interface do whatsapp web diretamente. problema disso é que não consigo responder mais de um usuário por vez... queria saber se tem como usar essa api daqui e ainda conseguir usar os comandos normais do selenium.

lfdelphino commented 4 years ago

Awesome idea, I'm from Brazil aswell, I hope you can share your bot with us when it's done :D I'll test sending large files today and edit here if I find something useful

você é brasileiro? kkk é falando comigo em inglês kkk enfim. tô com um bot já pronto que extrai o mp3 dos vídeos e envia pro usuário pelo whatsapp, e assim está funcionando muito bem, sem problemas, porém eu agora queria enviar vídeos também. porém sem sucesso. única forma que consegui enviar vídeos foi usando um método mais arcaico de enviar, usando selenium webdriver puro e fazendo ele interagir com a interface do whatsapp web diretamente. problema disso é que não consigo responder mais de um usuário por vez... queria saber se tem como usar essa api daqui e ainda conseguir usar os comandos normais do selenium.

OFF: É bom manter os issues em inglês porque a maioria do pessoal que acessa não fala português, aí você acaba até perdendo a oportunidade de ser ajudado por alguém que saiba.


I guess this happens due to some pre-processing that WhatsApp does for large files, but I'll have to check it. You can still send selenium commands while using this API, you may also change how Selenium initializes: https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/7367df67bda377df435d6473eb7adc37870cce21/webwhatsapi/__init__.py#L152-L245

erickythierry commented 4 years ago

Awesome idea, I'm from Brazil aswell, I hope you can share your bot with us when it's done :D I'll test sending large files today and edit here if I find something useful

você é brasileiro? kkk é falando comigo em inglês kkk enfim. tô com um bot já pronto que extrai o mp3 dos vídeos e envia pro usuário pelo whatsapp, e assim está funcionando muito bem, sem problemas, porém eu agora queria enviar vídeos também. porém sem sucesso. única forma que consegui enviar vídeos foi usando um método mais arcaico de enviar, usando selenium webdriver puro e fazendo ele interagir com a interface do whatsapp web diretamente. problema disso é que não consigo responder mais de um usuário por vez... queria saber se tem como usar essa api daqui e ainda conseguir usar os comandos normais do selenium.

OFF: É bom manter os issues em inglês porque a maioria do pessoal que acessa não fala português, aí você acaba até perdendo a oportunidade de ser ajudado por alguém que saiba.

I guess this happens due to some pre-processing that WhatsApp does for large files, but I'll have to check it. You can still send selenium commands while using this API, you may also change how Selenium initializes: https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/7367df67bda377df435d6473eb7adc37870cce21/webwhatsapi/__init__.py#L152-L245

can I still use selenium commands? if it's not too bothersome, do you know how I call the selenium methods?

lfdelphino commented 4 years ago

Access it through WhatsAPIDriver().driver, let's say you want to take a screenshot after a successful login using Selenium .save_screenshot(path):

from webwhatsapi import WhatsAPIDriver

driver = WhatsAPIDriver(loadstyles=True, headless=False)
print("Waiting for QR")
driver.wait_for_login()

driver.driver.save_screenshot("screenshot.png") # Notice the double driver here
print("Bot started: screenshot saved as 'screenshot.png'")
erickythierry commented 4 years ago

Access it through WhatsAPIDriver().driver, let's say you want to take a screenshot after a successful login using Selenium .save_screenshot(path):

from webwhatsapi import WhatsAPIDriver

driver = WhatsAPIDriver(loadstyles=True, headless=False)
print("Waiting for QR")
driver.wait_for_login()

driver.driver.save_screenshot("screenshot.png") # Notice the double driver here
print("Bot started: screenshot saved as 'screenshot.png'")

thank you very much. I was able to do what I wanted, now I can upload videos through the bot, too bad it's not using the API, but it's already worth it.

DeLuca92 commented 4 years ago

vou perguntar aqui para o @erickythierry . Cara, duvida; Essa api ainda tá funcionando? ELe abre um navegador ou ele faz as coisas por background?

erickythierry commented 4 years ago

vou perguntar aqui para o @erickythierry . Cara, duvida; Essa api ainda tá funcionando? ELe abre um navegador ou ele faz as coisas por background?

OFF:

a api usa o whatsapp web como forma de interagir com o whatsapp. então vai ser preciso abrir o navegador pra manipular as conversas. mas é tudo feito diretamente nas funções do javascript do whatsapp web. mas vai precisar de navegador sim. e uma versão específica se for usar o Firefox. uso a versão 61.

dekkardnexus5 commented 3 years ago

I am having problems using this feature too, when I try to send any file with mp4 extension, I get an error: Error in function sendImage (Timed out after 500000 ms). Command: return WAPI.sendImage('data:video/mp4;base64, (...)

erickythierry commented 3 years ago

I am having problems using this feature too, when I try to send any file with mp4 extension, I get an error: Error in function sendImage (Timed out after 500000 ms). Command: return WAPI.sendImage('data:video/mp4;base64, (...)

I still haven't been able to solve this problem. I had to get around it using a very grotesque solution that manipulates the whatsapp web interface as if it were a user by dragging and dropping the file on whatsapp web and clicking on send. but I recommend you use Chrome instead of Firefox, I had less problems with it