diff --git a/Socialmetrica.package/NitterUser.class/instance/asDictionaryForWeb.st b/Socialmetrica.package/NitterUser.class/instance/asDictionaryForWeb.st new file mode 100644 index 0000000..c42e00d --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/asDictionaryForWeb.st @@ -0,0 +1,28 @@ +accessing +asDictionaryForWeb + + | tweets tweetsHistogramData repliesHistogramData quotesHistogramData retweetsHistogramData | + tweets := self messages. + tweetsHistogramData := self tweetsByTimeSpan: 7. + repliesHistogramData := self repliesByWeeksTimeSpan. + quotesHistogramData := self quotesReportData. + retweetsHistogramData := self retweetsReportData. + + ^ { 'profile-card-avatar' -> self profileImageFile fullName. + 'profile-card-avatar-url' -> self profileImageUrl. + 'profile-card-fullname' -> self name . + 'profile-card-username' -> self userName . + 'profile-bio' -> self profileBio. + 'messages-size' -> tweets size. + 'messages-newest' -> tweets newest created asDate greaseString. + 'messages-oldest' -> tweets oldest created asDate greaseString. + 'tweets-histogram-labels' -> tweetsHistogramData third. + 'tweets-histogram-quantity' -> tweetsHistogramData second. + 'replies-histogram-labels' -> repliesHistogramData third. + 'replies-histogram-quantity' -> repliesHistogramData second. + 'retweets-histogram-labels' -> retweetsHistogramData third. + 'retweets-histogram-quantity' -> retweetsHistogramData second. + 'quotes-histogram-labels' -> quotesHistogramData third. + 'quotes-histogram-quantity' -> quotesHistogramData second. + 'wordcloud-data' -> self wordcloudData first. + } asDictionary \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/tweetsByTimeSpan..st b/Socialmetrica.package/NitterUser.class/instance/tweetsByTimeSpan..st new file mode 100644 index 0000000..ce42be2 --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/tweetsByTimeSpan..st @@ -0,0 +1,19 @@ +accessing +tweetsByTimeSpan: divisions + + | tweetsByTimeSpan xAxis labels | + tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: divisions. + xAxis := OrderedCollection new. + (tweetsByTimeSpan values collect: [ :collection | collection size ]) do: [ :number | + xAxis add: ($' asString), (number asString), ($' asString) + ]. + labels := OrderedCollection new. + tweetsByTimeSpan keys do: [ :string | + labels add: ($' asString), string, ($' asString) + ]. + ^ { + tweetsByTimeSpan. + ('[', (',' join: xAxis), ']'). + ('[', (',' join: labels), ']'). + } + \ No newline at end of file