32 lines
1.0 KiB
Smalltalk
32 lines
1.0 KiB
Smalltalk
accessing
|
|
collectRawTweetsForPages: anInteger
|
|
|
|
| pagesDict response customQuery |
|
|
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.
|
|
response tweets add: tempTweet.
|
|
]
|
|
].
|
|
response tweets doWithIndex: [ :tweet :i |
|
|
| current previous |
|
|
current := response tweets at: i.
|
|
i < response tweets size ifTrue: [
|
|
previous := response tweets at: i + 1.
|
|
current timelines
|
|
at: self userName put: previous id;
|
|
yourself ]].
|
|
^ response.
|
|
|