2023-03-03 12:22:55 +01:00
|
|
|
|
2023-03-10 11:20:37 +01:00
|
|
|
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";
|
2023-03-03 14:08:18 +01:00
|
|
|
|
2023-03-03 15:19:09 +01:00
|
|
|
const afis_rss_feed_url = 'https://afis.org/rss.xml';
|
|
|
|
const days_back_in_rss_feed = 7;
|
2023-03-03 14:08:18 +01:00
|
|
|
|
2023-03-03 15:19:09 +01:00
|
|
|
async function postLink() {
|
2023-03-03 14:08:18 +01:00
|
|
|
|
2023-03-03 17:28:41 +01:00
|
|
|
console.log("envoi de post des articles afis sciences publiés depuis " + days_back_in_rss_feed + " jours par le compte afis91")
|
2023-03-03 12:22:55 +01:00
|
|
|
|
2023-03-03 15:19:09 +01:00
|
|
|
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)
|
2023-03-03 12:22:55 +01:00
|
|
|
|
|
|
|
let configPost = {
|
|
|
|
author: 'afis91',
|
|
|
|
website: 'afis.org',
|
2023-03-03 15:19:09 +01:00
|
|
|
// disable_slugify: true,
|
|
|
|
slug: "afis_picture",
|
|
|
|
content_type: "text/markdown",
|
2023-03-20 13:56:02 +01:00
|
|
|
image: `${process.cwd()}/assets/afis_picture_of_the_day.jpg`,
|
2023-03-03 12:22:55 +01:00
|
|
|
message: `# ${contentOfPost}
|
2023-03-03 15:19:09 +01:00
|
|
|
|
|
|
|
#afis #science #pseudoScience #hebdo`,
|
2023-03-03 12:22:55 +01:00
|
|
|
}
|
2023-03-03 15:19:09 +01:00
|
|
|
sendPostMastodon(configPost)
|
2023-03-03 12:22:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
postLink();
|