diff --git a/lib/v2/tableau/maintainer.js b/lib/v2/tableau/maintainer.js new file mode 100644 index 00000000000000..0c70993a2e0c75 --- /dev/null +++ b/lib/v2/tableau/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/app/discover/viz-of-the-day': ['KaiyoungYu'], +}; diff --git a/lib/v2/tableau/radar.js b/lib/v2/tableau/radar.js new file mode 100644 index 00000000000000..6c561a00265a8c --- /dev/null +++ b/lib/v2/tableau/radar.js @@ -0,0 +1,11 @@ +module.exports = { + 'tableau.com': { + _name: 'Tableau', + public: [ + { + title: 'Viz of the day', + docs: 'https://docs.rsshub.app/routes/study#tableau', + }, + ], + }, +}; diff --git a/lib/v2/tableau/router.js b/lib/v2/tableau/router.js new file mode 100644 index 00000000000000..15d5d08c6b11ff --- /dev/null +++ b/lib/v2/tableau/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/viz-of-the-day', require('./viz-of-the-day')); +}; diff --git a/lib/v2/tableau/viz-of-the-day.js b/lib/v2/tableau/viz-of-the-day.js new file mode 100644 index 00000000000000..941cad7d4b9d9a --- /dev/null +++ b/lib/v2/tableau/viz-of-the-day.js @@ -0,0 +1,26 @@ +const got = require('@/utils/got'); +// const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + // Your logic here + const rootUrl = 'https://public.tableau.com/api/gallery?page=0&count=20&galleryType=viz-of-the-day'; + const { data: response } = await got(rootUrl); + + const items = response.items.map((item) => ({ + title: item.title, + link: item.sourceUrl, + pubDate: parseDate(item.galleryItemPublicationDate), + author: item.authorName, + description: `
${item.description}