diff --git a/lib/routes/houxu/lives.js b/lib/routes/houxu/lives.js index b802ea1387..b9de0097e5 100644 --- a/lib/routes/houxu/lives.js +++ b/lib/routes/houxu/lives.js @@ -1,13 +1,16 @@ const axios = require('../../utils/axios'); -const liveUrlById = (liveId) => `https://houxu.app/lives/${liveId}`; +const getLiveUrlById = (liveId) => `https://houxu.app/lives/${liveId}`; + +const getLinkDesc = (link) => (link.media === null ? link.description : link.media.name + ':
' + link.description); const realtimeHandler = async () => { const res = await axios.get('https://houxu.app/api/1/lives/updated/'); + const out = res.data.results.map((el) => ({ title: el.last.link.title, - description: el.last.link.media.name + ':
' + el.last.link.description, - link: liveUrlById(el.id), + description: getLinkDesc(el.last.link), + link: getLiveUrlById(el.id), guid: 'realtime-' + el.id + '-' + el.last.id, pubDate: new Date(el.last.create_at).toUTCString(), })); @@ -27,7 +30,7 @@ const newHandler = async () => { .map((el) => ({ title: el.object.title, description: el.object.summary, - link: liveUrlById(el.id), + link: getLiveUrlById(el.id), guid: 'new-' + el.id + '-' + el.object.id, pubDate: new Date(el.object.create_at).toUTCString(), }));