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

12 lines
490 B
Smalltalk

accessing
fromNitterTimelineItem: xmlItem
| author authorAndId |
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 .
"created := (xmlItem xpath: 'pubDate') stringValue.
text := (xmlItem xpath: 'description') stringValue."
id := authorAndId last copyReplaceAll: '#m"' with: ''.
authorId := self user id.