multi-account-post-schedule.../helpers/wip/recommandations_curator.mjs

83 lines
4.4 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() {
// selectionner un compte parmi les gens suivis dans une liste
// export des abonnements utilisateur https://mastodon.cipherbliss.com/settings/exports/follows.csv/home/cipherbliss/Nextcloud/inbox/following_accounts.csv
// <https://mastodon.cipherbliss.com/api/v1/accounts/1/following?max_id=19658>; rel="next", <https://mastodon.cipherbliss.com/api/v1/accounts/1/following?since_id=20294>; rel="prev"
// https://mastodon.cipherbliss.com/api/v1/accounts/relationships?id[]=109484382634211819&id[]=109280269336881811&id[]=109280889310776283&id[]=109248504398682634&id[]=109310268216721885&id[]=109916178850231009&id[]=109541053771316772&id[]=151980&id[]=80685&id[]=106835252230809041&id[]=109167546376395742&id[]=109791782092094822&id[]=109770197347890560&id[]=109768052505508503&id[]=108202891614303950&id[]=109749045115736569&id[]=109739290485102920&id[]=109330282577556324&id[]=109280646010767217&id[]=109722335836985403&id[]=109542013632346871&id[]=109278739925137927&id[]=109659515794606337&id[]=109292570383233152&id[]=109660244192213202&id[]=109303521370666602&id[]=109523867267929049&id[]=109643780720044907&id[]=109386436202793665&id[]=109501996699619458&id[]=109632939061534470&id[]=109621031128728719&id[]=109620790782200477&id[]=139144&id[]=109592762903342668&id[]=109603261782470086&id[]=109591788539379136&id[]=109570049875530270&id[]=109381927764082328&id[]=109554213128019255
// exemple d'account:
/**
{
"id": "109484382634211819",
"username": "GalmeshRosewood",
"acct": "GalmeshRosewood@mastodon.art",
"display_name": "Galmesh Rosewood",
"locked": false,
"bot": false,
"discoverable": true,
"group": false,
"created_at": "2022-12-05T00:00:00.000Z",
"note": "<p>I'm Galmesh Rosewood and I want to be a lewd artist. (It's a Monkey Island ref). Male from France. Some content won't be family-friendly.</p>",
"url": "https://mastodon.art/@GalmeshRosewood",
"avatar": "https://mastodon.cipherbliss.com/system/cache/accounts/avatars/109/484/382/634/211/819/original/4d3c4ded9ae95202.jpg",
"avatar_static": "https://mastodon.cipherbliss.com/system/cache/accounts/avatars/109/484/382/634/211/819/original/4d3c4ded9ae95202.jpg",
"header": "https://mastodon.cipherbliss.com/system/cache/accounts/headers/109/484/382/634/211/819/original/5b1822520e4ae3b3.png",
"header_static": "https://mastodon.cipherbliss.com/system/cache/accounts/headers/109/484/382/634/211/819/original/5b1822520e4ae3b3.png",
"followers_count": 762,
"following_count": 195,
"statuses_count": 327,
"last_status_at": "2023-03-04",
"emojis": [],
"fields": [
{
"name": "Linktree",
"value": "<a href=\"https://linktr.ee/galmeshrosewood\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">linktr.ee/galmeshrosewood</span><span class=\"invisible\"></span></a>",
"verified_at": null
}
]
}
*/
// faire un repost de média
// POST /api/v1/statuses/109965725969165853/reblog
// autre action:
// faire une liste de recommandation de 3 gens à follow au hasard pris dans cette liste,
// avec en image attachée un des médias postés par les comptes en question
// 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();