This commit is contained in:
ruidajo 2022-04-01 19:50:32 -05:00
commit 9b46b5cc83
11 changed files with 39 additions and 5 deletions

View File

@ -1,8 +1,13 @@
accessing
getMessages
| lastTweetsRaw lastTweets |
| lastTweetsRaw customQuery lastTweets |
lastTweetsRaw := self rssFeed xmlDocument xpath: '//item'.
lastTweets := TweetsCollection new.
customQuery := Dictionary new
at: 'parameters' put: self;
at: 'date' put: DateAndTime now;
yourself.
lastTweets query: customQuery.
lastTweetsRaw do: [ :rssTweet |
lastTweets add: ((Tweet new fromNitterRssItem: rssTweet ))
].

View File

@ -9,7 +9,7 @@ asCardElement
anEditor := BrEditor new
aptitude: BrGlamorousRegularEditorAptitude new + aModeLook;
text: self text;
text: self textPreview;
vFitContent.
textInfoPane := BrVerticalPane new

View File

@ -5,5 +5,5 @@ fromNitterRssItem: xmlItem
user := NitterUser new
userName: author .
created := (xmlItem xpath: 'pubDate') stringValue.
text := (XMLHTMLParser on: (xmlItem xpath: 'description') stringValue) parseDocument stringValue.
text := (xmlItem xpath: 'description') stringValue.
id := ((xmlItem xpath: 'guid') stringValue splitOn: '/') last copyReplaceAll: '#m' with: ''

View File

@ -2,4 +2,4 @@ accessing
printOn: aStream
super printOn: aStream.
aStream
nextPutAll: '( ',self text ,' )'
nextPutAll: '( ',self textPreview ,' )'

View File

@ -0,0 +1,6 @@
accessing
textPreview
"I'm a utility method to improve the way text is rendered accordin to if it comes from
Nitter or Twitter."
^ (XMLHTMLParser on: self text) parseDocument stringValue

View File

@ -0,0 +1,3 @@
accessing
dataStore
^ (FileLocator userData / 'Socialmetrica') ensureCreateDirectory

View File

@ -0,0 +1,6 @@
accessing
query: aDictionary
"The dictionary has two keys: the query parameter(s) itself
and the date when the query was executed.
Such information is used to store/serialize query results outside of the image."
query := aDictionary

View File

@ -0,0 +1,3 @@
accessing
query
^ query

View File

@ -0,0 +1,3 @@
accessing
queryParameters
^ self query at: 'parameters'

View File

@ -0,0 +1,7 @@
accessing
store
| localFolder parameters |
parameters := self queryParameters .
parameters class = NitterUser ifFalse: [ ^ self ].
^ localFolder := (self dataStore / parameters userName) ensureCreateDirectory.

View File

@ -6,7 +6,8 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"tweets"
"tweets",
"query"
],
"name" : "TweetsCollection",
"type" : "normal"