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

Techweekly
github.com/xiongwilee/…javascript

快速入门

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

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

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

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

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

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

$ node index.js复制代码

FYI: github

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

* 10 * * 5 cd /your/project/path/ && node index.js复制代码

贡献

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

"源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: ui

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

做者

相关文章
相关标签/搜索