up scripts
This commit is contained in:
parent
3bc27ba8cd
commit
b3c75294db
@ -85,9 +85,9 @@ https://mastodon.cipherbliss.com
|
|||||||
# Cronjob
|
# 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 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
|
# version avec scripts bash
|
||||||
0 7 * * * su tykayn -c "bash /home/tykayn/wiki_osm.sh"
|
0 7 * * * su tykayn -c "bash /home/tykayn/wiki_osm.sh"
|
||||||
*/30 * * * * su tykayn -c "bash /home/tykayn/meme_poster_random.sh"
|
*/30 * * * * su tykayn -c "bash /home/tykayn/meme_poster_random.sh"
|
||||||
|
BIN
assets/qzine_post_1.jpg
Executable file
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
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
BIN
assets/qzine_post_3.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 338 KiB |
@ -4,8 +4,8 @@ import sendPostMastodon, {randomIntFromInterval, findFirstImageInContent} from '
|
|||||||
|
|
||||||
const __dirname = path.resolve();
|
const __dirname = path.resolve();
|
||||||
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/cipherbliss_tkwp_posts.json", 'utf-8'))
|
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/cipherbliss_tkwp_posts.json", 'utf-8'))
|
||||||
const reallySendPost = false;
|
let reallySendPost = false;
|
||||||
// const reallySendPost = true;
|
reallySendPost = true;
|
||||||
|
|
||||||
|
|
||||||
export function getRandomElementOfArray(listItems) {
|
export function getRandomElementOfArray(listItems) {
|
||||||
@ -15,6 +15,7 @@ export function getRandomElementOfArray(listItems) {
|
|||||||
|
|
||||||
function getRandomLink() {
|
function getRandomLink() {
|
||||||
let filteredLinks = tkpostsjson.filter(elem => elem.post_status === 'publish')
|
let filteredLinks = tkpostsjson.filter(elem => elem.post_status === 'publish')
|
||||||
|
filteredLinks = filteredLinks.filter(elem => elem.post_type === 'post')
|
||||||
return getRandomElementOfArray(filteredLinks)
|
return getRandomElementOfArray(filteredLinks)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ function postLink() {
|
|||||||
|
|
||||||
let postObject = getRandomLink()
|
let postObject = getRandomLink()
|
||||||
console.log("envoi de post de blog cipherbliss par le compte tykayn")
|
console.log("envoi de post de blog cipherbliss par le compte tykayn")
|
||||||
|
console.log(postObject)
|
||||||
let filteredExcerpt = postObject.post_content.replace(/<[^>]+>/g, '')
|
let filteredExcerpt = postObject.post_content.replace(/<[^>]+>/g, '')
|
||||||
let counterLength = filteredExcerpt.length;
|
let counterLength = filteredExcerpt.length;
|
||||||
|
|
||||||
@ -34,15 +35,17 @@ function postLink() {
|
|||||||
|
|
||||||
let configPost = {
|
let configPost = {
|
||||||
author: 'tykayn',
|
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})
|
message: `# [${postObject.post_title}](https://www.cipherbliss.com/${postObject.post_name})
|
||||||
|
|
||||||
* ${postObject.post_date} - ${postObject.guid}
|
* ${postObject.post_date}
|
||||||
${filteredExcerpt}
|
|
||||||
|
> ${filteredExcerpt}
|
||||||
* #tykayn #cipherbliss #blog`,
|
* #tykayn #cipherbliss #blog`,
|
||||||
reallySendPost
|
reallySendPost
|
||||||
}
|
}
|
||||||
console.log("configPost.message", configPost.message)
|
console.log("configPost.message", configPost.message)
|
||||||
|
console.log("configPost.image", configPost.image)
|
||||||
|
|
||||||
|
|
||||||
sendPostMastodon(configPost)
|
sendPostMastodon(configPost)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from 'path';
|
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 __dirname = path.resolve();
|
||||||
const list_posts_json = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/qzine_posts_all.json", 'utf-8'))
|
const list_posts_json = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/qzine_posts_all.json", 'utf-8'))
|
||||||
// const reallySendPost = false;
|
let reallySendPost = false;
|
||||||
const reallySendPost = true;
|
reallySendPost = true;
|
||||||
|
|
||||||
|
|
||||||
export function getRandomElementOfArray(listItems) {
|
export function getRandomElementOfArray(listItems) {
|
||||||
@ -46,7 +47,8 @@ function postLink() {
|
|||||||
|
|
||||||
let configPost = {
|
let configPost = {
|
||||||
author: 'qzine',
|
author: 'qzine',
|
||||||
image: 'qzine_default.jpg',
|
// image: 'qzine_default.jpg',
|
||||||
|
image: 'qzine_post_' + randomIntFromInterval(1 , 3) + '.jpg',
|
||||||
message: `# [ !Qzine - ${postObject.title.rendered}](${postObject.link})
|
message: `# [ !Qzine - ${postObject.title.rendered}](${postObject.link})
|
||||||
|
|
||||||
* ${postObject.date} - ${postObject.link}
|
* ${postObject.date} - ${postObject.link}
|
||||||
@ -54,7 +56,7 @@ ${filteredExcerpt}
|
|||||||
* #qzine #qzineblog #blog #sexe #relations #éducation #plaisir #sociologie`,
|
* #qzine #qzineblog #blog #sexe #relations #éducation #plaisir #sociologie`,
|
||||||
reallySendPost
|
reallySendPost
|
||||||
}
|
}
|
||||||
console.log("configPost.message", configPost.message)
|
// console.log("configPost.message", configPost.message)
|
||||||
sendPostMastodon(configPost)
|
sendPostMastodon(configPost)
|
||||||
}
|
}
|
||||||
|
|
@ -4,8 +4,8 @@ import sendPostMastodon, {randomIntFromInterval} from './utils.mjs'
|
|||||||
|
|
||||||
const __dirname = path.resolve();
|
const __dirname = path.resolve();
|
||||||
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/tykayn_wptkblog_posts.json", 'utf-8'))
|
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname + "/assets/documents/tykayn_wptkblog_posts.json", 'utf-8'))
|
||||||
const reallySendPost = false;
|
let reallySendPost = false;
|
||||||
// const reallySendPost = true;
|
reallySendPost = true;
|
||||||
|
|
||||||
|
|
||||||
export function getRandomElementOfArray(listItems) {
|
export function getRandomElementOfArray(listItems) {
|
||||||
@ -34,7 +34,7 @@ function postLink() {
|
|||||||
|
|
||||||
let configPost = {
|
let configPost = {
|
||||||
author: 'tykayn',
|
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})
|
message: `# [${postObject.post_title}](${postObject.guid})
|
||||||
|
|
||||||
* ${postObject.post_date} - ${postObject.guid}
|
* ${postObject.post_date} - ${postObject.guid}
|
Loading…
Reference in New Issue
Block a user