Fixing page contents downloader and modifying tweets collection.

This commit is contained in:
ruidajo 2022-04-25 18:21:13 -05:00
parent a38124638d
commit b964460fa3
4 changed files with 6 additions and 11 deletions

View File

@ -3,9 +3,7 @@ collectRawTweetsUpToPage: anInteger
| pagesDict response customQuery |
pagesDict := self getPagesContentsUpto: anInteger.
response := TweetsCollection new
messages: OrderedCollection new;
yourself.
response := TweetsCollection new.
customQuery := Dictionary new
at: 'parameters' put: pagesDict keys;
at: 'date' put: DateAndTime now;
@ -19,16 +17,16 @@ collectRawTweetsUpToPage: anInteger
tempTweet metadata
at: DateAndTime now asString put: key;
yourself.
response messages add: tempTweet.
response add: tempTweet.
]
].
response messages doWithIndex: [ :tweet :i |
"response messages doWithIndex: [ :tweet :i |
| current previous |
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 ]].
yourself ]]."
^ response.

View File

@ -13,7 +13,7 @@ getPagesContentsUpto: anInteger
anInteger - 1 timesRepeat: [ | pageCursor |
pageCursor := self pageCursorFor:previousPageLink.
nextPageLink := self userNameLink, '/with_replies', pageCursor keys first.
response at: nextPageLink put: pageCursor values first.
response at: nextPageLink put: (XMLHTMLParser parse:nextPageLink asUrl retrieveContents).
previousPageLink := nextPageLink
].
^ response

View File

@ -1,3 +0,0 @@
accessing
add: aTweet
self messages add: aTweet

View File

@ -1,3 +1,3 @@
accessing
messages
^ array ifNil: [ array := OrderedCollection new ]
^ array "ifNil: [ array := OrderedCollection new ]"