I´m use msg.mediaData.attributes.renderableUrl to get blob url to download image. But now is undefined. Any ideias ?
same problem here
Help.
model.mediaData.mediaBlob is null
We have the same problem. We used to use message_js["mediaData"]["renderableUrl"] to retrieve the media but now, that attribute is "None"
I think it's an instability of WHATSAP, because the property sometimes
appears and sometimes it disappears in my browser, when that happens, only
the preview of the image works.
Em sex, 27 de set de 2019 Ã s 17:46, Giancarlo notifications@github.com
escreveu:
We have the same problem. We used to use
message_js["mediaData"]["renderableUrl"] to retrieve the media but now,
that attribute is "None"—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/718?email_source=notifications&email_token=AIDD5YOI6XAP5HW5HOY62Q3QLZWJTA5CNFSM4I3DHMG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD72BSIQ#issuecomment-536090914,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIDD5YL5WVGS747UE6XQLUTQLZWJTANCNFSM4I3DHMGQ
.
Edison Figueira Junior
11 99308-6451
for document, video and audio media type it works
just for image it's undefined
Any solution or walkthrough?
Anybody here had sucess ?
Em sex, 27 de set de 2019 19:58, yurik44 notifications@github.com
escreveu:
Any solution or walkthrough?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/718?email_source=notifications&email_token=AIDD5YNXESIOM74Z7B6CH2LQL2FXTA5CNFSM4I3DHMG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD72I5VI#issuecomment-536121045,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIDD5YKUASKDMU6BKJVKFSDQL2FXTANCNFSM4I3DHMGQ
.
Anybody here had sucess ? Em sex, 27 de set de 2019 19:58, yurik44 notifications@github.com escreveu:
…
Any solution or walkthrough? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#718?email_source=notifications&email_token=AIDD5YNXESIOM74Z7B6CH2LQL2FXTA5CNFSM4I3DHMG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD72I5VI#issuecomment-536121045>, or mute the thread https://github.com/notifications/unsubscribe-auth/AIDD5YKUASKDMU6BKJVKFSDQL2FXTANCNFSM4I3DHMGQ .
Not yet :(
I've noticed that there's a new way request when images are loaded
I got every parameters that the request require, but the request download a .enc file.
I'm tring to find the method thats create de blob' link but I'm not having luck with it and I'm not right that it is the correct way :(
downloadFile = function (msg, done) {
let xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
done(xhr.response, msg);
} else {
console.error(xhr.statusText);
}
} else {
console.log(err);
done(false);
}
};
xhr.open("GET", msg.clientUrl, true);
xhr.responseType = 'arraybuffer';
//xhr.responseType = 'blob';
xhr.send(null);
};
downloadFile(messageObj, function(result, message) {
console.log("Encryption Key:" + message.mediaKey);
console.log("Image Data:");
console.log(result);
Store.CryptoLib.decryptE2EMedia(message.type, result, message.mediaKey, message.mimetype).then(function(a) {
console.log("Decrypted Data:");
console.log(a);
console.log(a._blob);
let reader = new FileReader();
reader.readAsDataURL(a._blob);
reader.onload = function (e) {
console.log("FileReader result1:")
console.log(reader.result)
console.log("FileReader result2:")
console.log(reader.result.substr(reader.result.indexOf(',') + 1));
};
}).catch(function(e) {
console.log("Error: " + e);
});
});
Tnx @eduardobento
Just organizing a response from @eduardobento
window.WAPI.downloadFile = function (msg, done) {
let xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
done(xhr.response, msg);
} else {
console.error(xhr.statusText);
}
} else {
console.log(err);
done(false);
}
};
xhr.open("GET", msg.clientUrl, true);
xhr.responseType = 'arraybuffer';
//xhr.responseType = 'blob';
xhr.send(null);
};
function getMediaFile(msg, callbackFunction) {
window.WAPI.downloadFile(msg, function(result, message) {
Store.CryptoLib.decryptE2EMedia(message.type, result, message.mediaKey, message.mimetype).then(function(a) {
const reader = new FileReader();
reader.addEventListener('loadend', (e) => {
callbackFunction(e.target);
});
reader.readAsDataURL(a._blob);
});
});
}
It seems that this way, though, images are returned compressed and not in their original resolutions.
Or am I missing something here?
In python:
elif message.type == 'image' or message.type == 'video':
print('-- Image or Video')
print('filename', message.filename)
print('size', message.size)
print('mime', message.mime)
print('caption', message.caption)
print('client_url', message.client_url)
message.save_media('./images',force_download=True)
Most helpful comment
Tnx @eduardobento
Just organizing a response from @eduardobento