This article is based on the use of Node+ Puppeteer +wechaty to send a wechat love reminder picture to female (male) friends at regular times every day
Project introduction
I had a similar idea last year, but I didn’t do it until I saw an article last week.
However, some of his functions I do not need, and the regular reminder message can only be text, look not so good, so I plan to masturbate one, add some other small functions, and then have this article, before and after also spent more than two days, there are some optimization left empty to do.
inspiration
Use Node+wechaty to write a crawler script to send warm words to female (male) friends on wechat every day.
The project address
Github.com/Mcbai/WeCha…
Use the library
- Express-node framework
- Pug-html template
- Puppeteer – Fetch data
- Node-schedule – Scheduled task
- File-box – Package images for wechaty to send
- Wechaty – Operate wechat
- Qrcode-terminal-console Displays two-dimensional code pictures
The basic idea
- Capture ink weather and [one· one] data
- Write presentation templates and customize styles
- Process captured data rendering templates
- Grab the template page and take a screenshot
- Operate wechat to send messages
- Schedule tasks
The final result
It opens at the picture
Directory and Configuration
Directory structure:
Configuration code:
In the configuration, you can change the time of sending reminders, what you want to say, etc.
Pits to watch out for:
Puppeteer needs chromium installed, so you need to modify puppeteer.
npm config set puppeteer_download_host https://npm.taobao.org/mirrors
Copy the code
However, I modified the source on the cloud server but did not download it, so I have not been able to put it on the server so far. I can only use my own computer to install node Server.
Subsequent optimization:
- The code structure
- Generated image quality
- Generated chat log, other people’s messages can also be seen
- Save the images generated each day
The last
I hope all apes (yuan) can meet their own like, also like their other half ~