diff --git a/lib/v2/coindesk/index.js b/lib/v2/coindesk/index.js index d9b2dacb1..5d44cbd71 100644 --- a/lib/v2/coindesk/index.js +++ b/lib/v2/coindesk/index.js @@ -5,9 +5,8 @@ const rootUrl = 'https://www.coindesk.com'; module.exports = async (ctx) => { const channel = ctx.params.channel ?? 'consensus-magazine'; - const response = await got.get(`${rootUrl}/${channel}`); + const response = await got.get(`${rootUrl}/${channel}/`); const $ = cheerio.load(response.data); - const title = $('div.title-holder h2').text(); const content = JSON.parse( $('#fusion-metadata') .text() @@ -16,16 +15,15 @@ module.exports = async (ctx) => { const o1 = content['websked-collections']; // Object key names are different every week - const feature = o1[Object.keys(o1)[2]]; - const opinion = o1[Object.keys(o1)[3]]; + const articles = o1[Object.keys(o1)[2]]; - const list = [...feature.data, ...opinion.data]; + const list = articles.data; const items = list.map((item) => ({ title: item.headlines.basic, link: rootUrl + item.canonical_url, - description: title + '

' + item.subheadlines.basic, - pubDate: item.publish_date, + description: item.subheadlines.basic, + pubDate: item.display_date, })); ctx.state.data = {