diff --git a/Datanalitica.package/NitterUser.class/README.md b/Datanalitica.package/NitterUser.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/Datanalitica.package/NitterUser.class/instance/createdAt.st b/Datanalitica.package/NitterUser.class/instance/createdAt.st new file mode 100644 index 0000000..31412ab --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/createdAt.st @@ -0,0 +1,6 @@ +accessing +createdAt + ^ createdAt ifNil: [| joinDateString | + joinDateString := ((self documentTree xpath: '//div[@class="profile-joindate"]/span/@title') stringValue). + createdAt := (ZTimestampFormat fromString:'4:05 PM - 03 Feb 2001') parse: joinDateString. + ] \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/description.st b/Datanalitica.package/NitterUser.class/instance/description.st new file mode 100644 index 0000000..99dc25f --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/description.st @@ -0,0 +1,3 @@ +accessing +description + ^ description ifNil: [description := (self documentTree xpath: '//div[@class="profile-bio"]') stringValue] \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/documentTree.st b/Datanalitica.package/NitterUser.class/instance/documentTree.st new file mode 100644 index 0000000..49975d9 --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/documentTree.st @@ -0,0 +1,3 @@ +operation +documentTree + ^ (XMLDOMParser on: self userNameLink asUrl retrieveContents) parseDocument \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/name.st b/Datanalitica.package/NitterUser.class/instance/name.st new file mode 100644 index 0000000..e17d843 --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/name.st @@ -0,0 +1,3 @@ +accessing +name + ^ name ifNil: [ name := ((self rssFeed requiredItems title) splitOn: '/') first ] \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/profileImageUrl.st b/Datanalitica.package/NitterUser.class/instance/profileImageUrl.st new file mode 100644 index 0000000..4214b41 --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/profileImageUrl.st @@ -0,0 +1,3 @@ +accessing +profileImageUrl + ^ profileImageUrl ifNil: [ (self rssFeed xmlDocument xpath: '//image/url') stringValue copyReplaceAll: '%2F' with: '/' ] \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/rssFeed.st b/Datanalitica.package/NitterUser.class/instance/rssFeed.st new file mode 100644 index 0000000..e3f6d47 --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/rssFeed.st @@ -0,0 +1,4 @@ +accessing +rssFeed + + ^ RSSTools createRSSFeedFor: self userNameLink , '/rss' \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/userName..st b/Datanalitica.package/NitterUser.class/instance/userName..st new file mode 100644 index 0000000..48074cd --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/userName..st @@ -0,0 +1,3 @@ +accessing +userName: userNameString + userName := userNameString. \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/instance/userNameLink.st b/Datanalitica.package/NitterUser.class/instance/userNameLink.st new file mode 100644 index 0000000..a0fea3b --- /dev/null +++ b/Datanalitica.package/NitterUser.class/instance/userNameLink.st @@ -0,0 +1,4 @@ +accessing +userNameLink + + ^ 'https://nitter.net/' , self userName \ No newline at end of file diff --git a/Datanalitica.package/NitterUser.class/properties.json b/Datanalitica.package/NitterUser.class/properties.json new file mode 100644 index 0000000..f174467 --- /dev/null +++ b/Datanalitica.package/NitterUser.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "", + "super" : "TwitterUser", + "category" : "Datanalitica-Datanalitica", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "NitterUser", + "type" : "normal" +} \ No newline at end of file diff --git a/Datanalitica.package/TwitterUser.class/instance/createdAtShorted.st b/Datanalitica.package/TwitterUser.class/instance/createdAtShorted.st index b836829..4112e52 100644 --- a/Datanalitica.package/TwitterUser.class/instance/createdAtShorted.st +++ b/Datanalitica.package/TwitterUser.class/instance/createdAtShorted.st @@ -1,3 +1,3 @@ accessing createdAtShorted - ^ self createdAt asString copyFrom: 1 to: 7 \ No newline at end of file + ^ self createdAt asString copyFrom: 1 to: 10 \ No newline at end of file diff --git a/Datanalitica.package/TwitterUser.class/instance/fromNitterProfile..st b/Datanalitica.package/TwitterUser.class/instance/fromNitterProfile..st index 614fff1..f5bb9ef 100644 --- a/Datanalitica.package/TwitterUser.class/instance/fromNitterProfile..st +++ b/Datanalitica.package/TwitterUser.class/instance/fromNitterProfile..st @@ -1,14 +1,10 @@ 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. \ No newline at end of file + | nitterUser joinDateString | + nitterUser := NitterUser new userName: userNameString. + name := nitterUser name. + userName := NitterUser new userName: userNameString. + "((title splitOn: '/') second trimmed) allButFirst." "<--This should go to a test." + profileImageUrl := nitterUser profileImageUrl. + description := nitterUser description. + createdAt := nitterUser createdAt. \ No newline at end of file diff --git a/Datanalitica.package/TwitterUser.class/properties.json b/Datanalitica.package/TwitterUser.class/properties.json index e80aeb3..cd9b9ff 100644 --- a/Datanalitica.package/TwitterUser.class/properties.json +++ b/Datanalitica.package/TwitterUser.class/properties.json @@ -14,7 +14,8 @@ "metrics", "tweets", "createdAt", - "groups" + "groups", + "url" ], "name" : "TwitterUser", "type" : "normal"