Improved tweet metadata to reconstruct timelines and queries.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-04 10:42:39 -05:00
parent fb2feec7c3
commit 1aea7b1b7c
5 changed files with 21 additions and 19 deletions

View File

@ -4,19 +4,20 @@ getMessages
lastTweetsRaw := self rssFeed xmlDocument xpath: '//item'.
lastTweets := TweetsCollection new.
customQuery := Dictionary new
at: 'parameters' put: self;
at: 'parameters' put: self userNameLink;
at: 'date' put: DateAndTime now;
yourself.
lastTweets query: customQuery.
lastTweetsRaw doWithIndex: [ :rssTweet :i | | tempTweet |
tempTweet := Tweet new fromNitterRssItem: rssTweet.
tempTweet metadata
at: 'queryDate' put: (customQuery at: 'date');
at: 'order' put: i;
lastTweetsRaw doWithIndex: [ :rssTweet :i | | current previous |
current := Tweet new fromNitterRssItem: rssTweet.
i < lastTweetsRaw size ifTrue: [
previous := Tweet new fromNitterRssItem: (lastTweetsRaw at: i + 1).
current timelines
at: self userName put: previous id;
yourself.
tempTweet user userName = self userName
ifFalse: [ tempTweet retweetedBy add: self userName ].
lastTweets add: tempTweet
].
current queries add: customQuery.
lastTweets add: current.
].
^ lastTweets

View File

@ -25,14 +25,6 @@ asCardElement
fitContent;
cellSpacing: 5;
addChildren: {
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Toggle subtopics';
action: [ anEditor beEditable ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Add subtopic keyword';
action: [ anEditor beReadOnlyWithSelection ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Details';

View File

@ -0,0 +1,4 @@
accessing
queries
"A list of the queries where the tweet has been present"
^ self metadata at: 'queries' ifAbsentPut: [ OrderedCollection new ]

View File

@ -1,3 +1,3 @@
accessing
retweetedBy
^ self metadata at: 'retweetedBy' ifAbsentPut: [ Set new ]
^ self timelines keys collect: [ :author | author != self user userName ]

View File

@ -0,0 +1,5 @@
accessing
timelines
"A dictionary of several the timelines where this tweet appears.
The key is the user's timeline and the value is the message id before this particular message appears in such user's timeline."
^ self metadata at: 'timelines' ifAbsentPut: [ Dictionary new ].