Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用Node+puppeteer+wechaty每天定时给女(男)朋友发一张微信爱心提醒图 #24

Open
spivet opened this issue Mar 12, 2019 · 7 comments

Comments

@spivet
Copy link
Owner

spivet commented Mar 12, 2019

项目简介

通过微信每日定时给指定的一位好友发送消息,去年就有一个类似的想法,不过一直没去执行,直到上周看见篇文章。

不过他的一些功能我根本不需要,而且定时提醒消息只能是文字,看上去多少没那么好看,于是就打算自己撸一个,加了点其它的小功能,然后就有了这篇文章,前后也花了两天多时间,还有一些优化留着空了来做。

灵感来源

用Node+wechaty写一个爬虫脚本每天定时给女(男)朋友发微信暖心话

项目地址

https://github.com/Mcbai/WeChat-bot

使用库

基本思路

  1. 抓取 墨迹天气 和 [one·一个] 的数据
  2. 编写展示用的模板并自定义样式
  3. 处理抓取到的数据渲染模板
  4. 抓取模板页并截图
  5. 操作微信发送消息
  6. 定时处理任务

最终效果

webwxgetmsgimg

点开图片

template

目录与配置

目录结构:

image

配置代码:

image

在配置里可以修改提醒发送的时间,想要说的话等。

需要注意的坑:

puppeteer 需要安装 chromium,所以要修改 puppeteer 的下载源:

npm config set puppeteer_download_host https://npm.taobao.org/mirrors

但比较坑的是,我在云服务器上修改了源也没下载下来,所以到现在还没能放到服务器上去,只能在自己的电脑上起 node server。

后续优化:

  1. 代码结构
  2. 生成的图片质量
  3. 生成聊天记录日志,别人撤回的消息也能看见了
  4. 保存每天生成的图片

最后

希望所有猿(媛)都能遇见自己喜欢,也喜欢自己的另一半~

@AIysl
Copy link

AIysl commented Mar 21, 2019

牛b

@sfsoul
Copy link

sfsoul commented Apr 17, 2019

WechatIMG90

请问个问题,我已经单独安装了puppeteer到node_module包中,然后启动项目跑node app.js,一直卡在了这里。
Example app listening on port 3000!
09:19:24 INFO Wechaty start() v0.22.6 is starting...
09:19:24 INFO PuppetManager install(wechaty-puppet-puppeteer@^0.14.1) please wait ...
npm:

puppeteer@1.14.0 install /Users/jing_zhang/github_projects/WeChat-bot/node_modules/wechaty/node_modules/puppeteer
node install.js
看这个提示是在执行puppeteer包下面的install.js,请问这个如何解决呢?

@Geassu
Copy link

Geassu commented Jun 19, 2019

试了很久都生成不了图片。

@wangji817
Copy link

为何生成了本地图片之后,没有发送给对方??

@spivet
Copy link
Owner Author

spivet commented Jul 20, 2019

WechatIMG90

请问个问题,我已经单独安装了puppeteer到node_module包中,然后启动项目跑node app.js,一直卡在了这里。
Example app listening on port 3000!
09:19:24 INFO Wechaty start() v0.22.6 is starting...
09:19:24 INFO PuppetManager install(wechaty-puppet-puppeteer@^0.14.1) please wait ...
npm:

puppeteer@1.14.0 install /Users/jing_zhang/github_projects/WeChat-bot/node_modules/wechaty/node_modules/puppeteer
node install.js
看这个提示是在执行puppeteer包下面的install.js,请问这个如何解决呢?

这个过程第一次要下载chrome相关的东西,需要翻墙,否则就一直等待

@spivet
Copy link
Owner Author

spivet commented Jul 20, 2019

试了很久都生成不了图片。

我试了一下,没有问题,检查安装依赖的过程中,有没有报错,或者把node_modules删了重新安装

@spivet
Copy link
Owner Author

spivet commented Jul 20, 2019

为何生成了本地图片之后,没有发送给对方??

这个问题可以参考发送图片没有任何反应

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants