Minor fix in quotes scraping.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-18 22:14:17 -05:00
parent 2383ea4459
commit c2078d032f

View File

@ -1,14 +1,19 @@
accessing accessing
metadataFromNitterHtml: xmlItem metadataFromNitterHtml: xmlItem
| quoteSubtree |
self metadata self metadata
at: 'pinned' at: 'pinned'
put: (xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed put: (xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed
= 'Pinned Tweet'; = 'Pinned Tweet';
at: 'replie to' put: (xmlItem xpath: at: 'replie to'
'//div[@class="tweet-body"]//div[@class="replying-to"]') put: (xmlItem xpath: '//div[@class="tweet-body"]//div[@class="replying-to"]') stringValue trimmed.
stringValue trimmed; quoteSubtree := xmlItem xpath: '//div[@class="tweet-body"]//div[@class="quote quote-big"]//a[@class="quote-link"]'.
at: 'quote' put: (((xmlItem xpath: quoteSubtree set isEmpty
'//div[@class="tweet-body"]//div[@class="quote quote-big"]//a[@class="quote-link"]') ifTrue: [ self metadata at: 'quote' put: '' ]
postCopy asString splitOn: 'href="/') second removeSuffix: ifFalse: [
'"/>)') self metadata
at: 'quote'
put: ((quoteSubtree postCopy asString splitOn: 'href="/')
second removeSuffix: '"/>)')
]