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

做者

相關文章
相關標籤/搜索