fix(route): zhihu/topic add type of the article (#8953)

This commit is contained in:
Fatpandac 2022-02-02 23:32:07 +08:00 committed by GitHub
parent f4abc22dcb
commit a8fdec6621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const got = require('@/utils/got');
const utils = require('./utils');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const { topicId } = ctx.params;
@ -32,7 +33,7 @@ module.exports = async (ctx) => {
title = `${item.question.title}-${item.author.name}的回答:${item.excerpt}`;
description = `<strong>${item.question.title}</strong><br>${item.author.name}的回答<br/>${utils.ProcessImage(item.content)}`;
link = `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`;
pubDate = new Date(item.updated_time * 1000).toUTCString();
pubDate = parseDate(item.updated_time * 1000);
author = item.author.name;
break;
@ -40,7 +41,14 @@ module.exports = async (ctx) => {
title = item.title;
description = item.title;
link = `https://www.zhihu.com/question/${item.id}`;
pubDate = new Date(item.created * 1000).toUTCString();
pubDate = parseDate(item.created * 1000);
break;
case 'article':
title = item.title;
description = item.content;
link = item.url;
pubDate = parseDate(item.created * 1000);
break;
default: