Creating nitter user collection of urls for load more tweets and default config folder.

This commit is contained in:
ruidajo 2022-04-05 19:29:34 -05:00
parent 311c422216
commit 5b169c4ebf
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,5 @@
accessing
defaultConfig
self config: { 'folder' -> (FileLocator userData / 'Socialmetrica' / self userName) } asDictionary.
^ self config

View File

@ -0,0 +1,18 @@
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.