Techweekly:简单高可配的技术周报邮件推送工具

项目地址:https://github.com/xiongwilee/Techweeklyhtml

快速入门

第一步,下载代码,安装依赖:node

$ git clone https://github.com/xiongwilee/Techweekly.git
$ cd Techweekly && npm install --registry=https://registry.npm.taobao.org

第二步,修改邮件配置config/config.mail.jsgit

module.exports = {
  "sender": {
    "host": "邮箱服务器host",
    "port": "邮箱服务器端口号",
    "auth": {
      "user": "邮箱地址",
      "pass": "邮箱密码"
    }
  },
  "subject": "邮件主题",
  "from": "你的名字 <邮箱地址>",
  "to": ["收件人邮箱地址"]
}

或者,你也能够直接使用默认的邮箱配置config.mail.sample.js,修改config.mail.sample.jsconfig.mail.jsgithub

第三步,发送周报邮件:npm

$ node index.js

FYI: 服务器

若是你须要定时发送邮件,推荐使用crontab:url

* 10 * * 5 cd /your/project/path/ && node index.js

贡献

Techweekly默认支持fex75team两个默认周报源,你能够根据本身的需求配置周报来源:spa

"源ID(能够配置任意字符)": {
    /**
     * 页面链接,能够是一个string, 也能够是function,若是是function则:
     * @return {String} 页面URL
     */
    url: function() {},

    /**
     * 经过url获取文章内容URL的方法
     * @param  {string} html 经过页面链接爬取到的页面html
     * @return {String}      从html中解析到的文章内容的连接
     */
    getLink: function(html) {},

    /**
     * 经过文章内容的连接爬取到文章主体
     * @param  {String} html 经过文章内容的连接爬取到文章的html
     * @return {String}      文章主体部分的html
     */
    getContent: function(html) {}
}

FYI: code

getLinkgetContent方法里,你能够直接使用cheerio来解析DOM。htm

做者

相关文章
相关标签/搜索