Picture Credit: https://www.forsbergplustwo.com
Wechaty Puppet for WeChat
If you want to break the above limitations, please consider to use a Wechaty Puppet other than using Web API, like wechaty-puppet-padchat.
Learn more about the Puppet at Wechaty wiki: Puppet
Cause storage.googleapis.com
is blocked in mainland china, you'd better config by following guide.
PUPPETEER_DOWNLOAD_HOST=https://registry.npmmirror.com/mirrors npm install wechaty-puppet-wechat
SET PUPPETEER_DOWNLOAD_HOST=https://registry.npmmirror.com/mirrors npm install wechaty-puppet-wechat
Learn more from puppeteer/puppeteer#1597 (comment)
An example of adding executablePath to puppeteer.launch():
const bot = new Wechaty({
name: 'mybot',
puppet: 'wechaty-puppet-wechat',
// ...
puppetOptions: {
endpoint: '<executablePath>'
}
});
// or
const bot = new Wechaty({
name: 'mybot',
puppet: 'wechaty-puppet-wechat',
// ...
puppetOptions: {
launchOptions: {
executablePath: '<executablePath>',
// ... others launchOptions, see: https://github.com/GoogleChrome/puppeteer/blob/v1.18.1/docs/api.md#puppeteerlaunchoptions
}
}
});
We use stealth to make puppeteer more like a normal browser, if you want to disabled it, just set the WECHATY_PUPPET_WECHAT_PUPPETEER_STEALTHLESS
environment variable to 1
. eg. WECHATY_PUPPET_WECHAT_PUPPETEER_STEALTHLESS=1 ts-node your-bot.ts
In rare cases, we could meet some problem and see Error: Could not find expected browser
when we start PuppetWeChatBridge and try to run initBrowser()
. A easy way to solve this problem is set WECHATY_PUPPET_WECHAT_ENDPOINT
environment variable to <your executablePath>
. eg. WECHATY_PUPPET_WECHAT_ENDPOINT=/usr/bin/chromium-browser ts-node your-bot.ts
Option | value | default value | description |
---|---|---|---|
token | string | - | your own uos extspam value, see #127 |
endpoint | string | - | puppeteerlaunchoptions.executablePath |
head | boolean | false | puppeteerlaunchoptions.headless |
launchOptions | object | - | same to puppeteerlaunchoptions |
stealthless | boolean | false | disabled puppeteer-extra-plugin-stealth or not |
uos | boolean | false | enable UOS patch or not |
Release stable for the standard Web Protocol
Release 1.0 of Wechaty Puppet for WeChat
重磅:绕过登录限制,wechaty免费版web协议重放荣光
Rename NPM package name from wechaty-puppet-puppeteer
to wechaty-puppet-wechat
Release a version before upgrade.
wechaty-puppet-puppeteer
You need to be able to run chrome in your Linux environment. If you are using Ubuntu Linux:
apt install libnss3
apt install libgbm-dev
apt install libxshmfence-dev
apt install libxss1
See: wechaty/wechaty#1152
Huan LI Tencent TVP of Chatbot <[email protected]>