alfred82santa / whalesong

Whalesong is an asyncio python library to manage WebApps remotely. Currently WhatsappWeb is implemented
https://whalesong.readthedocs.io
MIT License
51 stars 19 forks source link

Simplified WhatsappWeb driver #42

Open alfred82santa opened 5 years ago

alfred82santa commented 5 years ago
jabolina commented 5 years ago

What is your thoughts about this one? Did a quick read about servo and this sound interesting.

alfred82santa commented 5 years ago

I don't have a clear idea, yet. There are some processes that they could be automatic, like QR refresh, session take over, message and chat monitor when online, etc.... Each one could be implemented as a class and when you create whalesong-whatsapp driver you could set which ones you want to use. On the other hand, most common monitor, like new message monitor, could be implemented as events on python. Perhaps it would simplify users' life who use whalesong-whatsapp.

parthibd commented 5 years ago

I think its a great idea ,specially monitoring for message,connection status ,qr.

jabolina commented 5 years ago

Have you guys seen this implementation? https://github.com/sigalor/whatsapp-web-reveng

parthibd commented 5 years ago

The main problem with that approach is getting banned. That's what happened to yowsup. I myself got banned for using yowsup. I was think as long as it is not necessary we should not be communicating with whatsapp protocol itself. But other than that, the project is very interesting. But for right now, whalesong is the right approach.

alfred82santa commented 5 years ago

@parthibd is right. It is a problem to get too much inside. We will become more vulnerable for any change. And more complicate to get online again. On the other hand there is a lot of logic implemented on WhatsappWeb that we would have to implement by ourself. However, I was looking for projects powered by this one, in order to create a new backend, just like Firefox or Chromium backends. We have a big problem with browser consumes...

parthibd commented 5 years ago

At this moment we should focus on the development on whalesong since projects depending on this are not very stable yet. In fact whalesong is more feature complete than the rest . I do agree browser consumes too much resources . But its a tradeoff we are making to get all possible features without getting into the implementation itself . We should be looking into creating a webview like @alfred82santa suggested . I am currently running some tests on some webview implementations including a custom browser backend made just for whalesong .

jabolina commented 5 years ago

Oh, I did not known that, I saw this repo yesterday. I'm really interested in trying to create this webview for whalesong too. What are you using to the tests?

parthibd commented 5 years ago

Well I'm using pywebview, qtwebview, javafx webview. But the problems with these is that they are too heavy and resource consumption is more or less than Firefox. So I don't think they'll be too viable. What we are looking for is a lightweight webview with the least possible resource consumption. I was suggested wpewebkit. Do you have anything in mind? We don't need to create the whole webview right away. What we need to do right now test which webview implementation uses the least resources.

parthibd commented 5 years ago

The project repo you suggested looks interesting. But sooner or later the project will suffer the fate of yowsup. But whalesong is very resilient to these if not unbreakable in functionality. And reverse engineering the js is relatively much easier than the whole protocol itself.

parthibd commented 5 years ago

So let's focus on improving the library, simplifying it. Even though whalesong is a bit slow, consumes too much resources due to the browser backends, but it just works.

Coming to the webview, we can create a simple wrapper around a light rendering engine like webkit and provide access point for whalesong to communicate. That way it will be a fully customized solution for whalesong. Please share your ideas and suggestions.

jabolina commented 5 years ago

I'll look into GTK, maybe C will be a good implementation for low memory consumption, or the native socket or protobuf for the communication. I've just went through some articles, I'll try to simulate them and see if this is possible, see if is possible to inject the JS, and analyze the memory usage. Another factor is to enable the headless mode too.