Now each tweet stores metadata about the Nitter timeline where it appears.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-11 20:46:22 -05:00
parent db1a8e0502
commit 9b99ed0e33

View File

@ -1,16 +1,18 @@
accessing accessing
collectRawTweetsForPages: anInteger collectRawTweetsForPages: anInteger
| pagesDict rawResponse response | | pagesDict response |
pagesDict := self pageURLs: anInteger. 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 := TweetsCollection new.
response query: pagesDict keys. 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. ^ response.