multi-account-post-schedule.../helpers/afis_science.mjs

36 lines
1.1 KiB
JavaScript

import sendPostMastodon, {
getArticlesFromDaysInRssFeed,
makeTitleContentFromRss,
parseRssFeed,
} from "./libs/utils.mjs";
const afis_rss_feed_url = 'https://afis.org/rss.xml';
const days_back_in_rss_feed = 7;
async function postLink() {
console.log("envoi de post des articles afis sciences publiés depuis " + days_back_in_rss_feed + " jours par le compte afis91")
let parsedFeed = await parseRssFeed(afis_rss_feed_url)
let articles = await getArticlesFromDaysInRssFeed(parsedFeed, days_back_in_rss_feed)
console.log('articles', articles)
let contentOfPost = 'Articles des ' + days_back_in_rss_feed + ' derniers jours sur le site web de l\'AFIS: \n'
+ makeTitleContentFromRss(articles)
let configPost = {
author: 'afis91',
website: 'afis.org',
// disable_slugify: true,
slug: "afis_picture",
content_type: "text/markdown",
folder_image: process.cwd() + '/assets/',
image: "afis_picture_of_the_day.jpg",
message: `# ${contentOfPost}
#afis #science #pseudoScience #hebdo`,
}
sendPostMastodon(configPost)
}
postLink();