Socialmetrica/Datanalitica.package/TwitterUser.class/instance/fromNitterProfile..st

10 lines
556 B
Smalltalk
Raw Normal View History

accessing
fromNitterProfile: userNameString
| rssFeed title |
rssFeed := RSSTools createRSSFeedFor: 'https://nitter.net/', userNameString, '/rss'.
title := rssFeed requiredItems title.
name := (title splitOn: '/') first trimmed.
"Tecnically we could just do 'userName' = 'userNameString'. But we want to capture also how it is expressed in the RSS."
userName := ((title splitOn: '/') second trimmed) allButFirst. "Taking out the '@' sign."
profileImageUrl := (rssFeed xmlDocument xpath: '//image/url') stringValue copyReplaceAll: '%2F' with: '/'.