fix(route): item links in zhubai top20 (#15823)

* fix(route): item links in zhubai top20

* fix(route): matcher in zhubai top20

---------

Co-authored-by: Jia-Jun, Yeh <xnumtw@gmail.com>
This commit is contained in:
Ethan Shen
2024-06-18 09:35:00 +08:00
committed by GitHub
parent bf269040d5
commit 965c056323
+2 -2
View File
@@ -51,7 +51,7 @@ async function handler(ctx) {
let items = response.data.slice(0, limit).map((item) => ({
title: item.pn,
link: item.fp ?? item.pq ?? item.pu,
link: item.pu ?? item.pq ?? item.fp,
description: item.pa,
author: item.zn,
pubDate: parseRelativeDate(item.lu.replace(/\.\d+/, '')),
@@ -60,7 +60,7 @@ async function handler(ctx) {
items = await Promise.all(
items.map((item) =>
cache.tryGet(item.link, async () => {
const matches = item.link.match(/\/(?:fp|pq|pu)\/([\w-]+)\/(\d+)/);
const matches = item.link.match(/\/(?:pl|pq|fp)\/([\w-]+)\/(\d+)/);
const { data } = await got(`https://${matches[1]}.zhubai.love/api/posts/${matches[2]}`);