fix(route): nogizaka46/news guid is not unique (#9137)

This commit is contained in:
Fatpandac 2022-02-18 21:01:44 +08:00 committed by GitHub
parent 0af66b1a7d
commit 8d4ed52bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1,12 +1,14 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const rootUrl = 'https://www.nogizaka46.com';
module.exports = async (ctx) => {
const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 25;
const response = await got({
method: 'get',
url: 'https://www.nogizaka46.com/s/n46/api/list/news',
url: `${rootUrl}/s/n46/api/list/news`,
headers: {
Referer: 'http://www.nogizaka46.com/',
},
@ -19,6 +21,7 @@ module.exports = async (ctx) => {
description: item.text,
pubDate: parseDate(item.date),
category: item.cate,
guid: rootUrl + new URL(item.link_url).pathname,
}));
ctx.state.data = {