diff --git a/lib/routes/finviz/news.js b/lib/routes/finviz/news.js index 4c19b2f3dd..c5d5a1d069 100644 --- a/lib/routes/finviz/news.js +++ b/lib/routes/finviz/news.js @@ -42,7 +42,7 @@ module.exports = async (ctx) => { const name = $('.fullview-title b').text(); ctx.state.data = { - title: `${name} News by Finviz`, + title: `${ctx.params.ticker} ${name} News by Finviz`, link, description: `A collection of ${name} news aggregated by Finviz.`, item, diff --git a/lib/routes/xueqiu/stock_info.js b/lib/routes/xueqiu/stock_info.js index c7f1213627..311012bd66 100644 --- a/lib/routes/xueqiu/stock_info.js +++ b/lib/routes/xueqiu/stock_info.js @@ -22,7 +22,9 @@ module.exports = async (ctx) => { const token = res1.headers['set-cookie'].find((s) => s.startsWith('xq_a_token=')).split(';')[0]; const $ = cheerio.load(res1.data); // 使用 cheerio 加载返回的 HTML - const stock_name = $('.stock-name').text(); + const stock_name = $('.stock-name') + .text() + .split('(')[0]; let query_url = 'https://xueqiu.com/statuses'; if (source === 'all') { @@ -52,14 +54,20 @@ module.exports = async (ctx) => { const data = res2.data.list; ctx.state.data = { - title: `${stock_name} - ${source}`, + title: `${id} ${stock_name} - ${source}`, link: `https://xueqiu.com/S/${id}`, description: `${stock_name} - ${source}`, - item: data.map((item) => ({ - title: item.title !== '' ? item.title : item.description.replace(/<[^>]+>/g, ''), - description: item.description, - pubDate: new Date(item.created_at).toUTCString(), - link: `https://xueqiu.com${item.target}`, - })), + item: data.map((item) => { + let link = `https://xueqiu.com${item.target}`; + if (item.quote_cards) { + link = item.quote_cards[0].target_url; + } + return { + title: item.title !== '' ? item.title : item.description.replace(/<[^>]+>/g, ''), + description: item.description, + pubDate: new Date(item.created_at).toUTCString(), + link, + }; + }), }; };