Socialmetrica/Socialmetrica.package/NitterUser.class/instance/numberOfURLsForLoadingTweet...

18 lines
633 B
Smalltalk

accessing
numberOfURLsForLoadingTweets: number
| collectionURLs count asURLs |
collectionURLs := {
self userNameLink .
(self userNameLink, ((self documentTree xPath: '//a[.="Load more"]') @ 'href') stringValue) .} asOrderedCollection.
number <= 2 ifTrue: [ ^ collectionURLs ].
count := 2.
(number-count) timesRepeat: [ | tempDoc |
tempDoc := XMLHTMLParser parse: (collectionURLs at: count) asUrl retrieveContents.
collectionURLs
add: (self userNameLink,
((tempDoc xPath: '//a[.="Load more"]') @ 'href') stringValue).
count := count+1 ].
asURLs := collectionURLs collect: [ :string | string asUrl ].
^ asURLs.