Adding tweet metadata and improving storage.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-02 12:00:26 -05:00
parent 3d2a3d8696
commit 92b8d90d1b
6 changed files with 24 additions and 5 deletions

View File

@ -8,8 +8,15 @@ getMessages
at: 'date' put: DateAndTime now;
yourself.
lastTweets query: customQuery.
lastTweetsRaw do: [ :rssTweet |
lastTweets add: ((Tweet new fromNitterRssItem: rssTweet ))
lastTweetsRaw doWithIndex: [ :rssTweet :i | | tempTweet |
tempTweet := Tweet new fromNitterRssItem: rssTweet.
tempTweet metadata
at: 'queryDate' put: (customQuery at: 'date');
at: 'order' put: i;
yourself.
tempTweet user userName = self userName
ifFalse: [ tempTweet retweetedBy add: self userName ].
lastTweets add: tempTweet
].
^ lastTweets

View File

@ -0,0 +1,3 @@
accessing
metadata: aDictionary
metadata := aDictionary

View File

@ -0,0 +1,3 @@
accessing
metadata
^ metadata ifNil: [ metadata := Dictionary new]

View File

@ -0,0 +1,3 @@
accessing
retweetedBy
^ self metadata at: 'retweetedBy' ifAbsentPut: [ Set new ]

View File

@ -11,7 +11,9 @@
"id",
"authorId",
"conversationId",
"user"
"user",
"metadata",
"metrics"
],
"name" : "Tweet",
"type" : "normal"

View File

@ -2,7 +2,8 @@ accessing
store
| localFolder parameters |
parameters := self queryParameters .
parameters class = NitterUser ifFalse: [ ^ self ].
localFolder := (self dataStore / parameters userName) ensureCreateDirectory.
(parameters class = NitterUser or: [ parameters class = TwitterUser ])
ifFalse: [ ^ self ].
localFolder := (self dataStore / 'twitter.com' / parameters userName) ensureCreateDirectory.
self tweets do: [:each | each exportInto: localFolder ].
^ localFolder