增加虎嗅网用户文章 (#1462)

以及时区 timezone util 类
This commit is contained in:
Henry Wang
2019-01-29 11:16:36 +00:00
committed by DIYgod
parent d2fafd71db
commit 21a7bf375c
4 changed files with 66 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
// const timezone = require('../../utils/timezone');
const date = require('../../../utils/date');
module.exports = async (ctx) => {
const { id } = ctx.params;
@@ -24,7 +24,7 @@ module.exports = async (ctx) => {
link: `https://wemp.app${$(e)
.find('.post-item__title')
.attr('href')}`,
pubDate: timezone(
pubDate: date(
`${year} ${$(e)
.find('.post-item__date')
.text()
@@ -34,11 +34,6 @@ module.exports = async (ctx) => {
author,
}));
// to be replaced
function timezone(html, timezone) {
return new Date(new Date(html).getTime() - 60 * 60 * 1000 * (timezone + new Date().getTimezoneOffset() / 60)).toUTCString();
}
ctx.state.data = {
title: `微信公众号 - ${author}`,
link: `https://wemp.app/accounts/${id}/`,