Skip to content

Commit

Permalink
fix(route): gameapps (#17207)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Oct 20, 2024
1 parent f7347d9 commit 1a6986f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 8 additions & 7 deletions lib/routes/gameapps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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/',
Expand All @@ -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,
},
Expand Down Expand Up @@ -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;
})
Expand Down
1 change: 0 additions & 1 deletion lib/routes/gameapps/templates/description.art
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<img src="{{ src }}"><br>
{{@ intro }}
{{@ desc }}

0 comments on commit 1a6986f

Please sign in to comment.