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

View File

@ -13,7 +13,7 @@ getPagesContentsUpto: anInteger
anInteger - 1 timesRepeat: [ | pageCursor | anInteger - 1 timesRepeat: [ | pageCursor |
pageCursor := self pageCursorFor:previousPageLink. pageCursor := self pageCursorFor:previousPageLink.
nextPageLink := self userNameLink, '/with_replies', pageCursor keys first. 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 previousPageLink := nextPageLink
]. ].
^ response ^ response

View File

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

View File

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