post with tk blog ban

This commit is contained in:
Tykayn 2022-08-08 18:43:26 +02:00 committed by tykayn
parent 9eb196aaa5
commit 5ba26c4c04
12 changed files with 11 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -2,12 +2,13 @@
// import rp from "request-promise"; // import rp from "request-promise";
// import $ from "cheerio"; // import $ from "cheerio";
import fs from "fs"; import fs from "fs";
import Masto from "mastodon";
import path from 'path'; import path from 'path';
const __dirname = path.resolve();
const tkpostsjson = JSON.parse(fs.readFileSync(__dirname +"/assets/documents/tykayn_wptkblog_posts.json", 'utf-8'))
import {sendPostMastodon} from './utils.js' import {sendPostMastodon} from './utils.js'
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;
export function getRandomElementOfArray(listItems) { export function getRandomElementOfArray(listItems) {
@ -30,19 +31,19 @@ function postLink() {
let limitExcerpt = 250 let limitExcerpt = 250
filteredExcerpt = filteredExcerpt.substring(0, limitExcerpt) filteredExcerpt = filteredExcerpt.substring(0, limitExcerpt)
if(filteredExcerpt && counterLength > limitExcerpt){ if (filteredExcerpt && counterLength > limitExcerpt) {
filteredExcerpt = ' _'+filteredExcerpt+'…_' filteredExcerpt = ' _' + filteredExcerpt + '…_'
} }
let configPost = { let configPost = {
author: 'tykayn', author: 'tykayn',
image: 'tk_blog_bannieres_oct2010-1.jpg',
message: `# [${postObject.post_title}](${postObject.guid}) message: `# [${postObject.post_title}](${postObject.guid})
* ${postObject.post_date} - ${postObject.guid} * ${postObject.post_date} - ${postObject.guid}
${filteredExcerpt} ${filteredExcerpt}
* #tykayn #tkblog #blog`, * #tykayn #tkblog #blog`,
reallySendPost: true, reallySendPost
// reallySendPost: false,
} }
console.log("configPost.message", configPost.message) console.log("configPost.message", configPost.message)
sendPostMastodon(configPost) sendPostMastodon(configPost)

View File

@ -120,7 +120,7 @@ export function sendPostMastodon(config) {
id = resp.data.id; id = resp.data.id;
params.media_ids = [id] params.media_ids = [id]
masto.post('statuses', params).then(rep => { masto.post('statuses', params).then(rep => {
console.log('rep', rep) // console.log('rep', rep)
console.log("posté avec une nouvelle image, WOOT") console.log("posté avec une nouvelle image, WOOT")
}, err => { }, err => {
console.error(err) console.error(err)

View File

@ -19,8 +19,8 @@ const __dirname = path.resolve();
const selectionOverrideOfSectionTable = ''; const selectionOverrideOfSectionTable = '';
const selectionOverrideOfLineTable = ''; const selectionOverrideOfLineTable = '';
let foundExistingWikiPageInFrench = false; // let foundExistingWikiPageInFrench = false;
// const reallySendToot = true; const reallySendToot = true;
const reallySendPost = false; const reallySendPost = false;
function getRandomWikiOSMPage() { function getRandomWikiOSMPage() {