过去可以使用JavaScript中的Store
对象访问http://web.whatsapp.com/。几个小时前,这停止了工作。它现在如何更新聊天数据?它必须在某处保存数据。
答案 0 :(得分:4)
我用它来再次获得商店:
setTimeout(function() {
// Returns promise that resolves to all installed modules
function getAllModules() {
return new Promise((resolve) => {
const id = _.uniqueId("fakeModule_");
window["webpackJsonp"](
[],
{
[id]: function(module, exports, __webpack_require__) {
resolve(__webpack_require__.c);
}
},
[id]
);
});
}
var modules = getAllModules()._value;
// Automatically locate modules
for (var key in modules) {
if (modules[key].exports) {
if (modules[key].exports.default) {
if (modules[key].exports.default.Wap) {
store_id = modules[key].id.replace(/"/g, '"');
}
}
}
}
}, 5000);
function _requireById(id) {
return webpackJsonp([], null, [id]);
}
// Module IDs
var store_id = 0;
var Store = {};
function init() {
Store = _requireById(store_id).default;
console.log("Store is ready" + Store);
}
setTimeout(function() {
init();
}, 7000);
只需在控制台上复制并粘贴,然后等待消息"存储已准备好"。 享受!
答案 1 :(得分:1)
要详细解释Pablo的答案,首先,我们使用基于此How do I require() from the console using webpack?的代码来加载所有Webpack模块。
本质上,getAllModules()
会返回Webpack中所有已安装模块的承诺。可以使用_requireById(id)
通过ID来请求每个模块,webpackJsonp(...)
使用Webpack公开的.carousel-control .icon-prev{
left: 5px
}
.carousel-control .icon-next{
right: 5px
}
函数。
加载模块后,我们需要确定与商店对应的 id 。我们搜索包含 exports.default.Wap 的模块,并将其 id 分配为商店ID。
您可以在我的github Wiki here
上找到更多详细信息。答案 2 :(得分:0)
一种更快的方法: 我抓取“应用”的源代码,然后找到商店对象
我将其保存在ZStore全局变量中。 :D
!function(){for(var t of document.getElementsByTagName("script"))t.src.indexOf("/app.")>0&&fetch(t.src,{method:"get"}).then(function(t){return t.text().then(function(t){var e=t.indexOf('var a={};t["default"]')-89;window.ZStore=window.webpackJsonp([],null,JSON.stringify(t.substr(e,10))).default})})}();
window.ZStore将包含该对象。
非最小版本:
(function() {
function getStore(url) {
fetch(url, {
"method": 'get'
}).then(function(response) {
return response.text().then(function(data) {
var offset = data.indexOf('var a={};t["default"]') - 89;
window.ZStore = window.webpackJsonp([], null, JSON.stringify(data.substr(offset, 10))).default
});
});
}
for (var e of document.getElementsByTagName("script")) {
if (e.src.indexOf("/app.") > 0) getStore(e.src);
}
})();