From ce1be4c8a597e803de87200e56bcc8afd71877b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=9B=E5=AD=A3=E5=A4=A9=E4=B9=A6SkiTiSu?= Date: Thu, 8 Aug 2019 21:30:31 +0800 Subject: [PATCH] feat: add pubDate for wangyin (#2777) * feat: add pubDate for wangyin * add author of wangyin --- docs/other.md | 2 +- lib/routes/blogs/wangyin.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/other.md b/docs/other.md index 8893105f1..8525cd66d 100644 --- a/docs/other.md +++ b/docs/other.md @@ -519,7 +519,7 @@ type 为 all 时,category 参数不支持 cost 和 free ### 王垠-当然我在扯淡 - + ## 古诗文网 diff --git a/lib/routes/blogs/wangyin.js b/lib/routes/blogs/wangyin.js index 60fd4ac90..fb8ac54b0 100644 --- a/lib/routes/blogs/wangyin.js +++ b/lib/routes/blogs/wangyin.js @@ -1,3 +1,4 @@ +const date = require('@/utils/date'); const got = require('@/utils/got'); const cheerio = require('cheerio'); @@ -11,12 +12,14 @@ module.exports = async (ctx) => { const element = $(e); const title = element.find('a').text(); const link = url + element.find('a').attr('href'); + const dateraw = /(\d+)\/(\d+)\/(\d+)/.exec(link); return { title: title, description: '', link: link, author: '王垠', + pubDate: date(`${dateraw[1]}-${dateraw[2]}-${dateraw[3]}`), }; }) .get();