fix(routes): fix feed images (#21573)
This commit is contained in:
@@ -92,8 +92,7 @@ export const handler = async (ctx): Promise<Data> => {
|
||||
|
||||
const title = $('title').text();
|
||||
const titleSplits = title.split(/_/);
|
||||
const image = $('div.logo img').prop('src');
|
||||
const icon = new URL($('link[rel="icon"]').prop('href'), rootUrl).href;
|
||||
const image = new URL($('link[rel="icon"]').prop('href'), rootUrl).href;
|
||||
|
||||
return {
|
||||
item: items,
|
||||
@@ -102,8 +101,8 @@ export const handler = async (ctx): Promise<Data> => {
|
||||
description: $('meta[name="description"]').prop('content'),
|
||||
language: $('html').prop('lang'),
|
||||
image,
|
||||
icon,
|
||||
logo: icon,
|
||||
icon: image,
|
||||
logo: image,
|
||||
subtitle: titleSplits[0],
|
||||
author: titleSplits.pop(),
|
||||
};
|
||||
|
||||
@@ -24,6 +24,16 @@ export const route: Route = {
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['china.kyodonews.net/news/:keyword', 'china.kyodonews.net/'],
|
||||
target: '/china/:keyword?',
|
||||
},
|
||||
{
|
||||
source: ['tchina.kyodonews.net/news/:keyword', 'tchina.kyodonews.net/'],
|
||||
target: '/tchina/:keyword?',
|
||||
},
|
||||
],
|
||||
name: '最新报道',
|
||||
maintainers: ['Rongronggg9'],
|
||||
handler,
|
||||
@@ -40,7 +50,7 @@ async function handler(ctx) {
|
||||
}
|
||||
|
||||
const rootUrl = `https://${language}.kyodonews.net`;
|
||||
const currentUrl = `${rootUrl}/${keyword ? (keyword === 'rss' ? 'rss/news.xml' : `news/${keyword}`) : ''}`;
|
||||
const currentUrl = `${rootUrl}/${keyword ? (keyword === 'rss' ? 'list/feed/rss4news' : `news/${keyword}`) : ''}`;
|
||||
|
||||
let response;
|
||||
try {
|
||||
@@ -52,7 +62,7 @@ async function handler(ctx) {
|
||||
const $ = load(response.data, { xmlMode: keyword === 'rss' });
|
||||
|
||||
let title, description, image, items;
|
||||
image = `${rootUrl}/apple-touch-icon-180x180.png`;
|
||||
image = `https://${language}-kyodo.ismcdn.jp/common/images/apple-touch-icon-180x180.png`;
|
||||
|
||||
if (keyword === 'rss') {
|
||||
title = $('channel > title').text();
|
||||
|
||||
@@ -218,7 +218,7 @@ async function handler(ctx) {
|
||||
title: `搜狐号 - ${globalConst.title}`,
|
||||
description: briefIntroductionCard.column_9_text,
|
||||
link: originalRequest.url,
|
||||
image: `https:${briefIntroductionCard.column_2_image}`,
|
||||
image: briefIntroductionCard.column_2_image.startsWith('http') ? briefIntroductionCard.column_2_image.replace('http:', 'https:') : `https:${briefIntroductionCard.column_2_image}`,
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user