Blockbuster notice

I’m glad to be able to write this post to inform you that Wechaty’s Web protocol is back in full play. If your previous wechat message tells you that you can’t log in to the web, then this is a good update for you. Now wechaty-Puppet-wechat already supports UOS wechat desktop protocol login, so please try it out.

How to use

NPM install wechaty-puppet-wechat –save

No intrusion into existing code, just updating dependencies

First, install the latest wechaty-Puppet-wechat dependency and configuration environment

NPM install qrcode-terminal --save NPM install wechaty NPM install wechaty-puppet-wechat --save WECHATY_PUPPET=wechaty-puppet-wechat // This is also key, need to configure your puppetCopy the code

Please ensure that your Puppet configuration is wechaty-puppet-wechat

If you are using ipadLocal and want to experience the Web protocol, follow the configuration as well

Case study:

index.js


const { Wechaty } = require('wechaty');

const name = 'wechat-puppet-wechat';
let bot = ' ';
bot = new Wechaty({
  name, // generate xxxx.memory-card.json and save login data for the next login
});

// Generate the qr code
function onScan(qrcode, status) {
  require('qrcode-terminal').generate(qrcode); // Display the QR code on the console
  const qrcodeImageUrl = [
    'https://wechaty.js.org/qrcode/'.encodeURIComponent(qrcode),
  ].join(' ');
  console.log(qrcodeImageUrl);
}

/ / login
async function onLogin(user) {
  console.log('Sweet little assistant${user}The login `);
  if (config.AUTOREPLY) {
    console.log('The robot chat mode has been started');
  }
  // Create a scheduled task after login
  await initDay();
}

/ / logout
function onLogout(user) {
  console.log(` little helper${user}'has been logged out);
}

bot.on('scan', onScan);
bot.on('login', onLogin);
bot.on('logout', onLogout);
bot
  .start()
  .then(() = > console.log('Start logging on wechat'))
  .catch((e) = > console.error(e));

Copy the code

According to the above configuration, pick up your phone scan code, you will find that you can not log in wechat before can also log in, surprise no, surprise no.

Q&A

1. Why do I update the latest dependency or prompt that I cannot log in to wechat on the Web side?

Please check the root directory of your project to see if there is a file like wechaty-puppet-wechat. Memory-card. json. If there is, please delete it and execute it again.

Does puppet guarantee that you can always bypass web logins?

For now, it seems possible to circumvent the Web restrictions, but there is no guarantee that this will change in the future

3, bypassing this restriction will be found by wechat banned?

The current way of bypassing is actually using the DESKTOP version of the UOS wechat request header, so if you do not violate the wechat protocol, the probability is ok. If you break wechat rules, you won’t know

More questions will be added according to the feedback

The principle of

Specific implementation principles can refer to the issues, code modification see github.com/wechaty/wec…

UOS under the wechat is just a webpage version of a electron, so there is a god on the comparison of the request head, found that as long as the request address first add a? Target =t that’s it https://wx.qq.com/?target=t

Then intercept the https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage request after the scan code login, and add two fixed parameters in the request header

extspam ='Gp8ICJkIEpkICggwMDAwMDAwMRAGGoAI1GiJSIpeO1RZTq9QBKsRbPJdi84ropi16EYI10WB6g74sGmRwSNXjPQnYUKYotKkvLGpshucCaeWZMOylnc6o2 AgDX9grhQQx7fm2DJRTyuNhUlwmEoWhjoG3F0ySAWUsEbH3bJMsEBwoB//0qmFJob74ffdaslqL+IrSy7LJ76/G5TkvNC+J0VQkpH1u3iJJs0uUYyLDzdBIQ 6Ogd8LDQ3VKnJLm4g/uDLe+G7zzzkOPzCjXL+70naaQ9medzqmh+/SmaQ6uFWLDQLcRln++wBwoEibNpG4uOJvqXy+ql50DjlNchSuqLmeadFoo9/mDT0q3G 7o/80P15ostktjb7h9bfNc+nZVSnUEJXbCjTeqS5UYuxn+HTS5nZsPVxJA2O5GdKCYK4x8lTTKShRstqPfbQpplfllx2fwXcSljuYi3YipPyS3GCAqf5A7aY YwJ7AvGqUiR2SsVQ9Nbp8MGHET1GxhifC692APj6SJxZD3i1drSYZPMMsS9rKAJTGz2FEupohtpf2tgXm6c16nDk/cw+C7K7me5j5PLHv55DFCS84b06AytZ PdkFZLj7FHOkcFGJXitHkX5cgww7vuf6F3p0yM/W73SoXTx6GX4G6Hg2rYx3O/9VU2Uq8lvURB4qIbD9XQpzmyiFMaytMnqxcZJcoXCtfkTJ6pI7a92JpRUv dSitg967VUDUAQnCXCM/m0snRkR9LtoXAO1FUGpwlp1EfIdCZFPKNnXMeqev0j9W9ZrkEs9ZWcUEexSj5z+dKYQBhIICviYUQHVqBTZSNy22PlUIeDeIs11j 7q4t8rD8LPvzAKWVqXE+5lS1JPZkjg4y5hfX1Dod3t96clFfwsvDP6xBSe1NBcoKbkyGxYK0UvPGtKQEE0Se2zAymYDv41klYE9s+rxp8e94/H8XhrL9oGm8 KWb2RmYnAE7ry9gd6e8ZuBRIsISlJAE/e8y8xFmP031S6Lnaet6YXPsFpuFsdQs535IjcFd75hh6DNMBYhSfjv456cvhsb99+fRw/KVZLC3yzNSCbLSyo9d9 BI45Plma6V8akURQA/qsaAzU0VyTIqZJkPDTzhuCl92vD2AD/QOhx6iwRSVPAxcRFZcWjgc2wCKh+uCYkTVbNQpB9B90YlNmI3fWTuUOUjwOzQRxJZj11Nsi mjOJ50qQwTTFj6qQvQ1a/I+MkTx5UO+yNHl718JWcR3AXGmv/aa9rD1eNP8ioTGlOZwPgmr2sor2iBpKTOrB83QgZXP+xRYkb4zVC+LoAXEoIa1+zArywlgR Eer7DLePukkU6wHTkuSaF+ge5Of1bXuU4i938WJHj0t3D8uQxkJvoFi/EYN/7u2P1zGRLV4dHVUsZMGCCtnO6BBigFMAA=' client-version' = '2.0.0',Copy the code

I really appreciate @Luv Letter’s explanation and @Artxia’s Chrome plugin code for giving me the opportunity to contribute to wechaty-Puppet-wechat

Rapid experience

If you want to quickly experience the full functions of Wechay and the visual configuration function, you can follow my wechat Daily Report and Smart Micro Secretary project. The above projects have updated the latest web protocol and all support web login.

Article history

  • Wechaty – Web – Panel visualization plug-in
  • Three steps teach you to use Node to make a wechat unsingle magic tool, small white can start