count toots

This commit is contained in:
Baptiste Lemoine 2020-10-18 13:58:21 +02:00
parent 022a1d2764
commit 0d73b82d15
5 changed files with 10 additions and 12 deletions

View File

@ -118,7 +118,6 @@ class Conversion {
// stats on recievers of toots
if (elem['object'].cc) {
elem['object'].cc.forEach(urlOfUser => {
console.log('copyFolk', urlOfUser);
if (!stats.recievers[urlOfUser]) {
stats.recievers[urlOfUser] = {
user : this.urlToUser(urlOfUser),
@ -134,7 +133,6 @@ class Conversion {
}
});
console.log('stats.hashtags', stats.hashtags[0]);
stats = {
recievers: this.sortTootsByLength(stats.recievers),
hashtags : this.sortTootsByLength(stats.hashtags),
@ -196,13 +194,10 @@ class Conversion {
return {};
}
this.fetched_times++;
console.log('attributeToUrl', attributeToUrl);
// return {};
let instanceHandle = this.findInstanceFromAttributedToUrl(attributeToUrl);
let splitted = attributeToUrl.split('/');
let accountHandle = splitted[splitted.length - 1];
console.log('splitted', splitted);
// memo things
let memoEntry = this.usersMemo[accountHandle + '@' + instanceHandle];
if (memoEntry) {
@ -226,8 +221,8 @@ class Conversion {
// handle success
// avatar is response.data.icon.url
// cover is response.data.image.url
console.log(response.data.icon);
console.log(response.data.image);
// console.log(response.data.icon);
// console.log(response.data.image);
if (!self.usersMemo[accountHandle + '@' + instanceHandle]) {
self.usersMemo[accountHandle + '@' + instanceHandle] = {};

View File

@ -10,12 +10,12 @@ var fs = require('fs');
var listenPort = 8088;
var jsonParsedLikes, jsonParsedOutbox;
// const min_length = 1050; // filter only long toots
const min_length = 1; // filter only long toots
const max_toots = 50; // filter only long toots
const min_length = 0; // filter only long toots
const max_toots = 100000; // filter only long toots
const filterBiggerTottsBeforeSlicing = false; // filter only long toots
const filterOnlyHavingMedias = true; // filter only toots having medias
const filterOnlyHavingMedias = false; // filter only toots having medias
const displayMedias = false; // filter only toots having medias
const writeStatsJson = false; // filter only toots having medias
const writeStatsJson = true; // filter only toots having medias
const showMostRecentTootsOnTop = true; // filter only toots having medias
const TemplateVars = {
pageTitle : 'Mastodon export converter to HTML',
@ -25,6 +25,7 @@ const TemplateVars = {
outbox_all : jsonParsedOutbox,
min_length,
max_toots,
toot_counter : 0,
filterOnlyHavingMedias,
filterBiggerTottsBeforeSlicing,
writeStatsJson,

BIN
public/avatar.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/header.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

View File

@ -5,14 +5,16 @@
div.column
div.item-list
#{toot_counter = outbox.length}
each oredredItem in outbox
article
div.toot_counter= toot_counter-=1
div.status.status-public
a(href=oredredItem['object'].url)="see"
i.fa.fa-paperplane-o
img.header(src='/avatar.gif')
div.date-published=oredredItem['object'].published
blockquote.published(escaped!=oredredItem['object'].content)
blockquote.published(unescaped!=oredredItem['object'].content)
if oredredItem['object'].attachment && oredredItem['object'].attachment.length
if(!displayMedias)
sub.no-media Medias are not displayed