Add RSS plugin (#192)
This commit is contained in:
@@ -11,9 +11,10 @@
|
||||
import twemojis from "twemoji-parser"
|
||||
import jimp from "jimp"
|
||||
import opengraph from "open-graph-scraper"
|
||||
import rss from "rss-parser"
|
||||
|
||||
//Exports
|
||||
export {fs, os, paths, url, util, processes, axios, puppeteer, git, opengraph}
|
||||
export {fs, os, paths, url, util, processes, axios, puppeteer, git, opengraph, rss}
|
||||
|
||||
/**Returns module __dirname */
|
||||
export function __module(module) {
|
||||
|
||||
22
source/app/mocks/api/axios/get/rss.mjs
Normal file
22
source/app/mocks/api/axios/get/rss.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Stackoverflow api
|
||||
if (/^https:..example.org.rss$/.test(url)) {
|
||||
console.debug(`metrics/compute/mocks > mocking rss feed result > ${url}`)
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
items:new Array(30).fill(null).map(_ => ({
|
||||
title:faker.lorem.sentence(),
|
||||
link:faker.internet.url(),
|
||||
content:faker.lorem.paragraphs(),
|
||||
contentSnippet:faker.lorem.paragraph(),
|
||||
isoDate:faker.date.recent(),
|
||||
})),
|
||||
title:faker.lorem.sentence(),
|
||||
description:faker.lorem.paragraph(),
|
||||
link:url,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -230,6 +230,18 @@
|
||||
favorites:distribution(7).map((value, index, array) => ({name:faker.lorem.word(), color:faker.internet.color(), value, size:faker.random.number(1000000), x:array.slice(0, index).reduce((a, b) => a + b, 0)}))
|
||||
}
|
||||
}) : null),
|
||||
//Languages
|
||||
...(set.plugins.enabled.rss ? ({
|
||||
rss:{
|
||||
source:faker.lorem.words(),
|
||||
description:faker.lorem.paragraph(),
|
||||
link:options["rss.source"],
|
||||
feed:new Array(Number(options["rss.limit"])).fill(null).map(_ => ({
|
||||
title:faker.lorem.sentence(),
|
||||
date:faker.date.recent()
|
||||
})),
|
||||
}
|
||||
}) : null),
|
||||
//Habits
|
||||
...(set.plugins.enabled.habits ? ({
|
||||
habits:{
|
||||
|
||||
Reference in New Issue
Block a user