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; at: 'date' put: DateAndTime now;
yourself. yourself.
lastTweets query: customQuery. lastTweets query: customQuery.
lastTweetsRaw do: [ :rssTweet | lastTweetsRaw doWithIndex: [ :rssTweet :i | | tempTweet |
lastTweets add: ((Tweet new fromNitterRssItem: rssTweet )) 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 ^ 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", "id",
"authorId", "authorId",
"conversationId", "conversationId",
"user" "user",
"metadata",
"metrics"
], ],
"name" : "Tweet", "name" : "Tweet",
"type" : "normal" "type" : "normal"

View File

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