Socialmetrica/Socialmetrica.package/Tweet.class/instance/fromNitterHtmlItem..st

20 lines
898 B
Smalltalk
Raw Normal View History

accessing
fromNitterHtmlItem: xmlItem
| author authorAndId timeTemp |
authorAndId := (((xmlItem xpath: '//a[@class="tweet-link"]') asString
splitOn: 'href="') second splitOn: '/') reject: [
:i | i isEmpty or: [ i = '>)' ] ].
author := authorAndId first.
user := NitterUser new userName: author.
timeTemp := (((xmlItem xpath: '//span[@class="tweet-date"]') asString
splitOn: 'title="') second splitOn: '">') first.
timeTemp := ((timeTemp copyReplaceAll: ' · ' with: ' ')
copyReplaceAll: 'UTC'
with: '+00:00') asDateAndTime.
created := timeTemp.
text := ((xmlItem xpath: '//div[@class="tweet-content media-body"]') asString allButLast)
copyReplaceAll: 'a XPathNodeSet(' with: '' .
id := authorAndId last copyReplaceAll: '#m"' with: ''.
authorId := self user id.
self metricsFromNitterHtml: xmlItem