up scripts

This commit is contained in:
Tykayn 2022-12-07 17:39:46 +01:00 committed by tykayn
parent 3bc27ba8cd
commit b3c75294db
7 changed files with 21 additions and 16 deletions

View File

@ -85,9 +85,9 @@ https://mastodon.cipherbliss.com
# Cronjob
```
12 12-14 * * * cd /home/tykayn/www/mastodon_multi_account && nvm use 16 && node helpers/tkblogPost.mjs | tee -a /home/tykayn/log_autopost.txt 2>&1
12 12-14 * * * cd /home/tykayn/www/mastodon_multi_account && nvm use 16 && node helpers/tykayn_blog.mjs | tee -a /home/tykayn/log_autopost.txt 2>&1
0 7 * * * cd /home/tykayn/www/mastodon_multi_account && nvm use 16 && node helpers/wiki_osm.mjs | tee -a /home/tykayn/log_autopost.txt 2>&1
0 0 * * * cd /home/tykayn/www/mastodon_multi_account && nvm use 16 && node helpers/postQzine.mjs | tee -a /home/tykayn/log_autopost.txt 2>&1
0 0 * * * cd /home/tykayn/www/mastodon_multi_account && nvm use 16 && node helpers/qzine_article.mjs | tee -a /home/tykayn/log_autopost.txt 2>&1
# version avec scripts bash
0 7 * * * su tykayn -c "bash /home/tykayn/wiki_osm.sh"
*/30 * * * * su tykayn -c "bash /home/tykayn/meme_poster_random.sh"

BIN
assets/qzine_post_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

BIN
assets/qzine_post_2.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

BIN
assets/qzine_post_3.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

View File

@ -4,8 +4,8 @@ import sendPostMastodon, {randomIntFromInterval, findFirstImageInContent} from '
const __dirname = path.resolve();
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/cipherbliss_tkwp_posts.json", 'utf-8'))
const reallySendPost = false;
// const reallySendPost = true;
let reallySendPost = false;
reallySendPost = true;
export function getRandomElementOfArray(listItems) {
@ -15,6 +15,7 @@ export function getRandomElementOfArray(listItems) {
function getRandomLink() {
let filteredLinks = tkpostsjson.filter(elem => elem.post_status === 'publish')
filteredLinks = filteredLinks.filter(elem => elem.post_type === 'post')
return getRandomElementOfArray(filteredLinks)
}
@ -22,7 +23,7 @@ function postLink() {
let postObject = getRandomLink()
console.log("envoi de post de blog cipherbliss par le compte tykayn")
console.log(postObject)
let filteredExcerpt = postObject.post_content.replace(/<[^>]+>/g, '')
let counterLength = filteredExcerpt.length;
@ -34,15 +35,17 @@ function postLink() {
let configPost = {
author: 'tykayn',
image: 'cipherbliss_post_' + randomIntFromInterval(1 - 3) + '.jpg',
image: 'cipherbliss_post_' + randomIntFromInterval(1 , 3) + '.jpg',
message: `# [${postObject.post_title}](https://www.cipherbliss.com/${postObject.post_name})
* ${postObject.post_date} - ${postObject.guid}
${filteredExcerpt}
* ${postObject.post_date}
> ${filteredExcerpt}
* #tykayn #cipherbliss #blog`,
reallySendPost
}
console.log("configPost.message", configPost.message)
console.log("configPost.image", configPost.image)
sendPostMastodon(configPost)

View File

@ -1,6 +1,7 @@
import fs from "fs";
import path from 'path';
import sendPostMastodon from './utils.mjs'
import sendPostMastodon, {randomIntFromInterval, findFirstImageInContent} from './utils.mjs'
/**
*
@ -16,8 +17,8 @@ import sendPostMastodon from './utils.mjs'
const __dirname = path.resolve();
const list_posts_json = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/qzine_posts_all.json", 'utf-8'))
// const reallySendPost = false;
const reallySendPost = true;
let reallySendPost = false;
reallySendPost = true;
export function getRandomElementOfArray(listItems) {
@ -46,7 +47,8 @@ function postLink() {
let configPost = {
author: 'qzine',
image: 'qzine_default.jpg',
// image: 'qzine_default.jpg',
image: 'qzine_post_' + randomIntFromInterval(1 , 3) + '.jpg',
message: `# [ !Qzine - ${postObject.title.rendered}](${postObject.link})
* ${postObject.date} - ${postObject.link}
@ -54,7 +56,7 @@ ${filteredExcerpt}
* #qzine #qzineblog #blog #sexe #relations #éducation #plaisir #sociologie`,
reallySendPost
}
console.log("configPost.message", configPost.message)
// console.log("configPost.message", configPost.message)
sendPostMastodon(configPost)
}

View File

@ -4,8 +4,8 @@ import sendPostMastodon, {randomIntFromInterval} from './utils.mjs'
const __dirname = path.resolve();
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/tykayn_wptkblog_posts.json", 'utf-8'))
const reallySendPost = false;
// const reallySendPost = true;
let reallySendPost = false;
reallySendPost = true;
export function getRandomElementOfArray(listItems) {
@ -34,7 +34,7 @@ function postLink() {
let configPost = {
author: 'tykayn',
image: 'tk_blog_bannieres_oct2010-' + randomIntFromInterval(1 - 10) + '.jpg',
image: 'tk_blog_bannieres_oct2010-' + randomIntFromInterval(1 , 10) + '.jpg',
message: `# [${postObject.post_title}](${postObject.guid})
* ${postObject.post_date} - ${postObject.guid}