From 9b99ed0e33f309742c529ffb0adae71c80594047 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 11 Apr 2022 20:46:22 -0500 Subject: [PATCH] Now each tweet stores metadata about the Nitter timeline where it appears. --- .../instance/collectRawTweetsForPages..st | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsForPages..st b/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsForPages..st index 59b5494..ce5dbac 100644 --- a/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsForPages..st +++ b/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsForPages..st @@ -1,16 +1,18 @@ accessing collectRawTweetsForPages: anInteger - | pagesDict rawResponse response | + | pagesDict response | pagesDict := self pageURLs: anInteger. - rawResponse := OrderedCollection new. - pagesDict values do: [ :each | - rawResponse addAll: ((each xpath: '//div[@class="timeline-item "]') asOrderedCollection - collect: [ :xmlElement | xmlElement postCopy ]) - - ]. response := TweetsCollection new. response query: pagesDict keys. - response tweets: (rawResponse collect: [ :tweet | Tweet new fromNitterHtmlItem: tweet ]). + 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 queries add: key. + response tweets add: tempTweet. + ] + ]. ^ response. \ No newline at end of file