multi-account-post-schedule.../helpers/afis_science.mjs
2023-03-20 13:56:02 +01:00

34 lines
1.2 KiB
JavaScript

import {getArticlesFromDaysInRssFeed} from "./libs/rss_management.mjs";
import {makeTitleContentFromRss} from "./libs/rss_management.mjs";
import sendPostMastodon from "./libs/utils.mjs";
import {parseRssFeed} from "./libs/rss_management.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",
image: `${process.cwd()}/assets/afis_picture_of_the_day.jpg`,
message: `# ${contentOfPost}
#afis #science #pseudoScience #hebdo`,
}
sendPostMastodon(configPost)
}
postLink();