Socialmetrica/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsUpToPage..st

32 lines
1.0 KiB
Smalltalk
Raw Permalink Normal View History

accessing
2022-04-19 00:00:58 +00:00
collectRawTweetsUpToPage: anInteger
| pagesDict response customQuery |
2022-04-12 21:05:59 +00:00
pagesDict := self getPagesContentsUpto: anInteger.
response := TweetsCollection new.
customQuery := Dictionary new
at: 'parameters' put: pagesDict keys;
at: 'date' put: DateAndTime now;
yourself.
response query: customQuery.
pagesDict keysAndValuesDo: [ :key :rawTweets | | temp |
temp := (rawTweets xpath: '//div[@class="timeline-item "]') asOrderedCollection
collect: [ :xmlElement | xmlElement postCopy ].
temp do: [ :tweet | | tempTweet |
tempTweet := Tweet new fromNitterHtmlItem: tweet.
tempTweet metadata
at: DateAndTime now asString put: key;
yourself.
2022-04-14 22:40:41 +00:00
response messages add: tempTweet.
]
].
2022-04-14 22:40:41 +00:00
response messages doWithIndex: [ :tweet :i |
| current previous |
2022-04-14 22:40:41 +00:00
current := response messages at: i.
i < response messages size ifTrue: [
previous := response messages at: i + 1.
current timelines
at: self userName put: previous id;
yourself ]].
^ response.