diff --git a/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st b/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st index cf3171b..915e05e 100644 --- a/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st +++ b/Socialmetrica.package/Tweet.class/instance/metadataFromNitterHtml..st @@ -1,14 +1,19 @@ accessing metadataFromNitterHtml: xmlItem + | quoteSubtree | 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 + at: 'replie to' + put: (xmlItem xpath: '//div[@class="tweet-body"]//div[@class="replying-to"]') stringValue trimmed. + quoteSubtree := xmlItem xpath: '//div[@class="tweet-body"]//div[@class="quote quote-big"]//a[@class="quote-link"]'. + quoteSubtree set isEmpty + ifTrue: [ self metadata at: 'quote' put: '' ] + ifFalse: [ + self metadata + at: 'quote' + put: ((quoteSubtree postCopy asString splitOn: 'href="/') + second removeSuffix: '"/>)') + ] \ No newline at end of file