diff --git a/Socialmetrica.package/NitterUser.class/instance/getMessages.st b/Socialmetrica.package/NitterUser.class/instance/getMessages.st index e87fd33..f33b045 100644 --- a/Socialmetrica.package/NitterUser.class/instance/getMessages.st +++ b/Socialmetrica.package/NitterUser.class/instance/getMessages.st @@ -1,4 +1,4 @@ accessing getMessages - self getLocalMessages ifNil: [ self getRemoteMessages ]. + self getLocalMessages ifNil: [ self getRemoteMessagesFromRss ]. ^ self tweets \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/getRemoteMessages.st b/Socialmetrica.package/NitterUser.class/instance/getRemoteMessagesFromRss.st similarity index 93% rename from Socialmetrica.package/NitterUser.class/instance/getRemoteMessages.st rename to Socialmetrica.package/NitterUser.class/instance/getRemoteMessagesFromRss.st index c278a47..1e29c10 100644 --- a/Socialmetrica.package/NitterUser.class/instance/getRemoteMessages.st +++ b/Socialmetrica.package/NitterUser.class/instance/getRemoteMessagesFromRss.st @@ -1,5 +1,5 @@ accessing -getRemoteMessages +getRemoteMessagesFromRss | customQuery lastTweetsRaw lastTweets | lastTweetsRaw := self rssFeed xmlDocument xpath: '//item'. diff --git a/Socialmetrica.package/NitterUser.class/instance/lastTweetsFromHtml.st b/Socialmetrica.package/NitterUser.class/instance/lastTweetsFromHtml.st new file mode 100644 index 0000000..b37f07b --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/lastTweetsFromHtml.st @@ -0,0 +1,5 @@ +accessing +lastTweetsFromHtml + + ^ (self documentTree xpath: '//div[@class="timeline-item "]') + asOrderedCollection collect: [ :xmlElement | xmlElement postCopy ] \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/numberOfURLsForLoadingTweets..st b/Socialmetrica.package/NitterUser.class/instance/numberOfURLsForLoadingTweets..st index 8d6063b..574cc83 100644 --- a/Socialmetrica.package/NitterUser.class/instance/numberOfURLsForLoadingTweets..st +++ b/Socialmetrica.package/NitterUser.class/instance/numberOfURLsForLoadingTweets..st @@ -3,33 +3,35 @@ numberOfURLsForLoadingTweets: number | collectionURLs count asURLs urlAndTweets | number = 1 ifTrue: [ ^ self ]. - + urlAndTweets := OrderedDictionary new. - collectionURLs := { self userNameLink .}asOrderedCollection. - - urlAndTweets - at: 'tweets' - put: ((self documentTree xpath: '//div[@class="timeline-item "]')asOrderedCollection collect: [ :xmlElement | xmlElement postCopy]). - + collectionURLs := { self userNameLink } asOrderedCollection. + + urlAndTweets at: 'tweets' put: self lastTweetsFromHtml. + count := 1. - (number-count) timesRepeat: [ | tempDoc docTree urlString | - tempDoc := XMLHTMLParser parse: - (collectionURLs at: count) asUrl retrieveContents. - - urlString := (self userNameLink, - ((tempDoc xPath: '//a[.="Load more"]') @ 'href') stringValue). + number - count timesRepeat: [ + | tempDoc docTree urlString | + tempDoc := XMLHTMLParser parse: + (collectionURLs at: count) asUrl retrieveContents. + + urlString := self userNameLink + , + ((tempDoc xPath: '//a[.="Load more"]') @ 'href') + stringValue. docTree := XMLHTMLParser parse: urlString asUrl retrieveContents. - collectionURLs - add: urlString. - - urlAndTweets - at: 'tweets-', (urlString splitOn: 'cursor=') second - put: ((docTree xpath: '//div[@class="timeline-item "]')asOrderedCollection - collect: [ :xmlElement | xmlElement postCopy ]). - count := count+1 ]. - + collectionURLs add: urlString. + + urlAndTweets + at: 'tweets-' , (urlString splitOn: 'cursor=') second + put: + ((docTree xpath: '//div[@class="timeline-item "]') + asOrderedCollection collect: [ :xmlElement | + xmlElement postCopy ]). + count := count + 1 ]. + asURLs := collectionURLs collect: [ :string | string asUrl ]. - + urlAndTweets at: 'urls' put: asURLs. - - ^ urlAndTweets. \ No newline at end of file + + ^ urlAndTweets \ No newline at end of file