14 lines
1013 B
Smalltalk
14 lines
1013 B
Smalltalk
accessing
|
|
fromNitterProfile: userNameString
|
|
| nitterProfileLink rssFeed title nitterDocTree joinDateString |
|
|
nitterProfileLink := 'https://nitter.net/', userNameString.
|
|
rssFeed := RSSTools createRSSFeedFor: nitterProfileLink, '/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: '/'.
|
|
nitterDocTree := (XMLDOMParser on: nitterProfileLink asUrl retrieveContents) parseDocument.
|
|
description := (nitterDocTree xpath: '//div[@class="profile-bio"]') stringValue.
|
|
joinDateString := ((nitterDocTree xpath: '//div[@class="profile-joindate"]/span/@title') stringValue).
|
|
createdAt := (ZTimestampFormat fromString:'4:05 PM - 03 Feb 2001') parse: joinDateString. |