sarfraznawaz2005 / whatspup Goto Github PK
View Code? Open in Web Editor NEW:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer
License: MIT License
:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer
License: MIT License
I´ve achieved a login without showing Chromes window here: https://github.com/yeikiu/waar but keep getting the annoying Google Chrome 36+
error on random moments. When it does by clicking right click on refresh and choosing Force empty cache and hard reload
it then shows the QR. You think we can trigger that from within puppeteer as a fallback startegy?
when headless is true, not work why? is an issue from puppeteer?
I try run 'web.whatsapp.com' and take screenshot http://i.cubeupload.com/RmJXwC.png with headless mode
Is it possible to implement a larger storage of the history of a conversation?
Currently:
After opening a chat, you only get to see the last message you received.
My hope:
Would it be possible to retrieve the last N number of messages, so I can see what I missed, while in another chat.
When run chat.js appear a message Initializing..
-open browser ok
-i scan the qr ok
╔══════════════╗
║ ║
║ Whatspup ║
║ ║
╚══════════════╝
Initializing...
Unhandled Rejection at: Promise Promise {
Error: waiting failed: timeout 30000ms exceeded
at Timeout.WaitTask._timeoutTimer.setTimeout (/home/al/Descargas/whatspup-master/node_modules/puppeteer/lib/FrameManager.js:789:58)
at ontimeout (timers.js:458:11)
at tryOnTimeout (timers.js:296:5)
at Timer.listOnTimeout (timers.js:259:5) } reason: Error: waiting failed: timeout 30000ms exceeded
at Timeout.WaitTask._timeoutTimer.setTimeout (/home/al/Descargas/whatspup-master/node_modules/puppeteer/lib/FrameManager.js:789:58)
at ontimeout (timers.js:458:11)
at tryOnTimeout (timers.js:296:5)
at Timer.listOnTimeout (timers.js:259:5)
It almost work on mac but it's stuck at "initialisation...".
Also, in the phone app the connexion is name Windows 8.1 while I'm on mac.
Is there any way to get the user phone number?
If I'm accessing a remote linux server with Putty on windows, how can I use this project?
Thanks so much!
How can i list all open chats?
22:39:38 - warn: Error: Failed to launch chrome!
[25780:25780:0221/223938.126938:FATAL:zygote_host_impl_linux.cc(124)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x55696ba448ec base::debug::StackTrace::StackTrace()
Hi,
I have 30 seconds timeout error with "pupeteer" after "Initializating...".
On MacOS.
Any problem ?
I receive messages from who I'm chatting with now, but I don't receive messages from other users.
What is happening?
Than you.
This software haven't like restore backup incremental. I use KDE NEON 18.04.
Unhandled Rejection at: Promise Promise { <rejected> Error: waiting failed: timeout 30000ms exceeded at Timeout.WaitTask._timeoutTimer.setTimeout (C:\Users\Adiel\Downloads\whatspup-master\whatspup-master\node_modules\puppeteer\lib\FrameManager.js:695:58) at ontimeout (timers.js:478:11) at tryOnTimeout (timers.js:302:5) at Timer.listOnTimeout (timers.js:262:5) } reason: Error: waiting failed: timeout 30000ms exceeded at Timeout.WaitTask._timeoutTimer.setTimeout (C:\Users\Adiel\Downloads\whatspup-master\whatspup-master\node_modules\puppeteer\lib\FrameManager.js:695:58) at ontimeout (timers.js:478:11) at tryOnTimeout (timers.js:302:5) at Timer.listOnTimeout (timers.js:262:5)
Mentioning @contact@
async function typeMessage(message) {
let fs = []
let parts = message.split('\n');
for (var i = 0; i < parts.length; i++) {
fs.push({type: 'down', command: 'Shift'})
fs.push({type: 'press', command: 'Enter'})
fs.push({type: 'up', command: 'Shift'})
//Mentioning @contact@
if(parts[i].includes('@')) {
let parts2 = parts[i].split('@');
for (var j = 0; j < parts2.length; j++) {
let contact = parts2[j].slice(0,1) === ' ' ? parts2[j].slice(1,parts2[j].length) : parts2[j]
if(contact.length > 3 && parts[i].indexOf('@' + contact) >= 0) {
fs.push({type: 'type', command: '@' + contact.slice(0, -1), wait: 1000})
fs.push({type: 'press', command: 'Enter', wait: 500})
}
else {
fs.push({type: 'type', command: contact})
}
}
}
else {
fs.push({type: 'type', command: parts[i]})
}
}
for(let i = 0; i < fs.length; i++) {
await page.keyboard[fs[i].type](fs[i].command)
await wait(fs[i].wait ? fs[i].wait : 100)
}
await page.keyboard.press('Enter');
...
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
How you u handled 1 time qr code scanning in this project??
The new message from any user is not working.
the css selector does not select nothing :( (obfuscated name)
Hi , I am not receiving msg in cli could you help me please
HI bro, when people send images the code get blocked until all images in the group chat window get loaded, did you had the same issue? do you know how to fix it? this is the part of the code that give me a timeout error;
`lastMessageGlobal : async function readLastOtherPersonMessage(page,name) {
let message = '';
//let name = await this.currentUser(page);
if (!name) {
return false;
}
//scroll last message
await page.evaluate((selector) => {
try {
document.querySelector(selector).scrollIntoView({behavior: 'smooth',block:'end'});
} catch (err) {
console.log(err);
}
}, selector.last_message);
// read last message sent by other user
message = await page.evaluate((selector) => {
let nodes = document.querySelectorAll(selector);
let el = nodes[nodes.length - 1];
if (!el) {
return '';
}
let picNodes = el.querySelectorAll("img[src*='blob']");
let isPicture = picNodes[picNodes.length - 1];
if (isPicture) {
return 'Picture Message';
}
// check if it is gif message
let gifNodes = el.querySelectorAll("div[style*='background-image']");
let isGif = gifNodes[gifNodes.length - 1];
if (isGif) {
return 'Gif Message';
}
// check if it is video message
let vidNodes = el.querySelectorAll(".video-thumb");
let isVideo = vidNodes[vidNodes.length - 1];
if (isVideo) {
return 'Video Message';
}
// check if it is voice message
let audioNodes = el.querySelectorAll("audio");
let isAudio = audioNodes[audioNodes.length - 1];
if (isAudio) {
return 'Voice Message';
}
// check if it is emoji message
let emojiNodes = el.querySelectorAll("div.selectable-text img.selectable-text");
let isEmoji = emojiNodes[emojiNodes.length - 1];
if (isEmoji) {
var emoArray = [];
var imgEmoji = 'https://web.whatsapp.com'+document.querySelector('._2DV1k').getAttribute('src');
var imgLocal = './public/images/emoji/88179f049c0d1d26c823d2954ecb54a7_w_e1854-64.png';
emoArray = ['emoji',imgEmoji,imgLocal];
return emoArray;
}
// text message
nodes = el.querySelectorAll('span.selectable-text');
el = nodes[nodes.length - 1];
return el ? el.innerHTML : '';
}, selector.last_message);
//if message is array lets prepare it to be an string
if(Array.isArray(message) == true && message[0] == "emoji"){
message = await this.getEmoji(message);
}
//get ligatures
var ligatureName = await this.ligatures(page,name);
var ligatureMessage = await this.ligatures(page,message);
let user = await this.currentUser(page);
//load from session
last_received_message = ssn.last_received_message;
if (message && user == name) {
if (last_received_message || ssn.messagesCount == 0) {
if (Array.isArray(message) == false && last_received_message != message) {
ssn.last_received_message = message;
this.print(ligatureName + ": " + ligatureMessage, config.received_message_color);
return ligatureMessage;
}
}
else {
ssn.last_received_message = message;
ssn.messagesCount = (ssn.messagesCount + 1);
console.log('count: ',ssn.messagesCount);
return ligatureMessage;
}
}
}`
I have changed the code a little bit to adapt it to my apps need ... please help.
Would it be possible to have a separate section of the screen dedicated to typing a message?
Currently if you get a response from someone it disturbs the typing of your message.
on new messages show the user phone number
Is there a way to send shift + enter?
This is useful to create newlines in messages
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.