diff --git a/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st b/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st new file mode 100644 index 0000000..cf3171b --- /dev/null +++ b/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st @@ -0,0 +1,14 @@ +accessing +metadataFromNitterHtml: xmlItem + + self metadata + at: 'pinned' + put: (xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed + = 'Pinned Tweet'; + at: 'replie to' put: (xmlItem xpath: + '//div[@class="tweet-body"]//div[@class="replying-to"]') + stringValue trimmed; + at: 'quote' put: (((xmlItem xpath: + '//div[@class="tweet-body"]//div[@class="quote quote-big"]//a[@class="quote-link"]') + postCopy asString splitOn: 'href="/') second removeSuffix: + '"/>)') \ No newline at end of file diff --git a/Socialmetrica.package/Tweet.class/instance/metricsFromNitterHtml..st b/Socialmetrica.package/Tweet.class/instance/metricsFromNitterHtml..st index 1bd3dbb..bbb13fd 100644 --- a/Socialmetrica.package/Tweet.class/instance/metricsFromNitterHtml..st +++ b/Socialmetrica.package/Tweet.class/instance/metricsFromNitterHtml..st @@ -1,28 +1,24 @@ accessing metricsFromNitterHtml: xmlItem + "TO DO: Metrics scrapping are not consistent. Most times they store numbers, but sometimes, retweets store a userName" - self metrics - at: 'comment' - put: (((xmlItem xpath: '//div[@class="tweet-stats"]//div[@class="icon-container"]') - select: [ :item | item asString includesSubstring: 'comment' ]) - stringValue trimmed copyReplaceAll: ',' with: ''); - at: 'retweet' - put: (((xmlItem xpath: '//div[@class="tweet-stats"]//div[@class="icon-container"]') - select: [ :item | item asString includesSubstring: 'retweet' ]) - stringValue trimmed copyReplaceAll: ',' with: ''); - at: 'quote' - put: (((xmlItem xpath: '//div[@class="tweet-stats"]//div[@class="icon-container"]') - select: [ :item | item asString includesSubstring: 'quote' ]) - stringValue trimmed copyReplaceAll: ',' with: ''); - at: 'heart' - put: (((xmlItem xpath: '//div[@class="tweet-stats"]//div[@class="icon-container"]') - select: [ :item | item asString includesSubstring: 'heart' ]) - stringValue trimmed copyReplaceAll: ',' with: ''). - self metadata - at: 'pinned' - put: (xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed = 'Pinned Tweet'; - at: 'replie to' - put: (xmlItem xpath: '//div[@class="tweet-body"]//div[@class="replying-to"]') stringValue trimmed; - at: 'quote' - put: ((((((xmlItem xpath: '//div[@class="tweet-body"]//div[@class="quote quote-big"]//a[@class="quote-link"]') postCopy) asString) splitOn: 'href="/') second) removeSuffix: '"/>)') \ No newline at end of file + + self metrics + at: 'comment' put: (((xmlItem xpath: + '//div[@class="tweet-stats"]//div[@class="icon-container"]') + select: [ :item | item asString includesSubstring: 'comment' ]) + stringValue trimmed copyReplaceAll: ',' with: ''); + at: 'retweet' put: (((xmlItem xpath: + '//div[@class="tweet-stats"]//div[@class="icon-container"]') + select: [ :item | item asString includesSubstring: 'retweet' ]) + stringValue trimmed copyReplaceAll: ',' with: ''); + at: 'quote' put: (((xmlItem xpath: + '//div[@class="tweet-stats"]//div[@class="icon-container"]') + select: [ :item | item asString includesSubstring: 'quote' ]) + stringValue trimmed copyReplaceAll: ',' with: ''); + at: 'heart' put: (((xmlItem xpath: + '//div[@class="tweet-stats"]//div[@class="icon-container"]') + select: [ :item | item asString includesSubstring: 'heart' ]) + stringValue trimmed copyReplaceAll: ',' with: ''). + self metadataFromNitterHtml: xmlItem \ No newline at end of file