diff --git a/lib/routes/gameapps/index.ts b/lib/routes/gameapps/index.ts index 6aee2775ede713..7ef3c7c30c286b 100644 --- a/lib/routes/gameapps/index.ts +++ b/lib/routes/gameapps/index.ts @@ -3,7 +3,7 @@ import { getCurrentPath } from '@/utils/helpers'; const __dirname = getCurrentPath(import.meta.url); import cache from '@/utils/cache'; -import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import parser from '@/utils/rss-parser'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; @@ -12,13 +12,13 @@ import path from 'node:path'; export const route: Route = { path: '/', + example: '/gameapps', radar: [ { source: ['gameapps.hk/'], - target: '', }, ], - name: 'Unknown', + name: '最新消息', maintainers: ['TonyRL'], handler, url: 'gameapps.hk/', @@ -31,7 +31,7 @@ async function handler() { const items = await Promise.all( feed.items.map((item) => cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link, { + const response = await ofetch(item.link, { headers: { Referer: baseUrl, }, @@ -71,12 +71,13 @@ async function handler() { } item.description = art(path.join(__dirname, 'templates/description.art'), { - src: $('div.introduction.media.news-intro div.media-left').find('img').attr('src'), - intro: $('div.introduction.media.news-intro div.media-body').html().trim(), - desc: content.html().trim(), + intro: $('div.introduction.media.news-intro div.media-body').html()?.trim(), + desc: content.html()?.trim(), }); item.guid = item.guid.substring(0, item.link.lastIndexOf('/')); item.pubDate = parseDate(item.pubDate); + item.enclosure_url = $('div.introduction.media.news-intro div.media-left').find('img').attr('src'); + item.enclosure_type = 'image/jpeg'; return item; }) diff --git a/lib/routes/gameapps/templates/description.art b/lib/routes/gameapps/templates/description.art index d41376f7f63928..7ba352613e8e52 100644 --- a/lib/routes/gameapps/templates/description.art +++ b/lib/routes/gameapps/templates/description.art @@ -1,3 +1,2 @@ -
{{@ intro }} {{@ desc }}