From bd69b735299d530947cc76e50d87e7e47a81970a Mon Sep 17 00:00:00 2001 From: ruidajo Date: Mon, 25 Apr 2022 18:59:10 -0500 Subject: [PATCH] Fixing raw tweets collection and tweets filtering from html. --- .../NitterUser.class/instance/collectRawTweetsUpToPage..st | 7 ++++--- Socialmetrica.package/NitterUser.class/instance/quotes.st | 2 +- Socialmetrica.package/NitterUser.class/instance/replies.st | 2 +- .../NitterUser.class/instance/retweets.st | 2 +- Socialmetrica.package/NitterUser.class/instance/tweets.st | 2 +- .../TweetsCollection.class/instance/lastIndex.st | 4 ++++ .../TweetsCollection.class/instance/messages.st | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 Socialmetrica.package/TweetsCollection.class/instance/lastIndex.st diff --git a/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsUpToPage..st b/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsUpToPage..st index 88149e6..304d9fe 100644 --- a/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsUpToPage..st +++ b/Socialmetrica.package/NitterUser.class/instance/collectRawTweetsUpToPage..st @@ -20,13 +20,14 @@ collectRawTweetsUpToPage: anInteger response add: tempTweet. ] ]. - "response messages doWithIndex: [ :tweet :i | + response messages: (response messages select: [ :tweet | tweet isNotNil ]). + response messages doWithIndex: [ :tweet :i | | current previous | current := response messages at: i. - i < response messages size ifTrue: [ + i < response lastIndex ifTrue: [ previous := response messages at: i + 1. current timelines at: self userName put: previous id; - yourself ]]." + yourself ]]. ^ response. \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/quotes.st b/Socialmetrica.package/NitterUser.class/instance/quotes.st index 3895f62..9d30abf 100644 --- a/Socialmetrica.package/NitterUser.class/instance/quotes.st +++ b/Socialmetrica.package/NitterUser.class/instance/quotes.st @@ -3,7 +3,7 @@ quotes self messages ifEmpty: [ self getMessages ]. ^ TweetsCollection new - messages: (self messages messages + messages: (self messages select: [ :each | (each metadata at: 'quote') isNotEmpty and: [ each user userName = self userName] ]); yourself \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/replies.st b/Socialmetrica.package/NitterUser.class/instance/replies.st index 138fedc..47f42c6 100644 --- a/Socialmetrica.package/NitterUser.class/instance/replies.st +++ b/Socialmetrica.package/NitterUser.class/instance/replies.st @@ -3,5 +3,5 @@ replies self messages ifEmpty: [ self getMessages ]. ^ TweetsCollection new - messages: (self messages messages select: [ :each | (each metadata at: 'replie to') isNotEmpty ]); + messages: (self messages select: [ :each | (each metadata at: 'replie to') isNotEmpty ]); yourself \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/retweets.st b/Socialmetrica.package/NitterUser.class/instance/retweets.st index 3ba3e1e..8f4ccbe 100644 --- a/Socialmetrica.package/NitterUser.class/instance/retweets.st +++ b/Socialmetrica.package/NitterUser.class/instance/retweets.st @@ -3,5 +3,5 @@ retweets self messages ifEmpty: [ self getMessages ]. ^ TweetsCollection new - messages: (self messages messages select: [ :each | each authorId ~= self id]); + messages: (self messages select: [ :each | each authorId ~= self id]); yourself \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/tweets.st b/Socialmetrica.package/NitterUser.class/instance/tweets.st index 342bf3a..304500b 100644 --- a/Socialmetrica.package/NitterUser.class/instance/tweets.st +++ b/Socialmetrica.package/NitterUser.class/instance/tweets.st @@ -2,5 +2,5 @@ accessing tweets self messages ifEmpty: [ self getMessages ]. ^ TweetsCollection new - messages: (self messages messages select: [ :each | each authorId = self id ]); + messages: (self messages select: [ :each | each authorId = self id ]); yourself \ No newline at end of file diff --git a/Socialmetrica.package/TweetsCollection.class/instance/lastIndex.st b/Socialmetrica.package/TweetsCollection.class/instance/lastIndex.st new file mode 100644 index 0000000..db62201 --- /dev/null +++ b/Socialmetrica.package/TweetsCollection.class/instance/lastIndex.st @@ -0,0 +1,4 @@ +accessing +lastIndex + + ^ lastIndex \ No newline at end of file diff --git a/Socialmetrica.package/TweetsCollection.class/instance/messages.st b/Socialmetrica.package/TweetsCollection.class/instance/messages.st index 1e354aa..268e962 100644 --- a/Socialmetrica.package/TweetsCollection.class/instance/messages.st +++ b/Socialmetrica.package/TweetsCollection.class/instance/messages.st @@ -1,3 +1,3 @@ accessing messages - ^ array "ifNil: [ array := OrderedCollection new ]" \ No newline at end of file + ^ array \ No newline at end of file