Improving NitterUser and Tweet from nitter information.

This commit is contained in:
ruidajo 2022-03-29 17:10:43 -05:00
parent a1519fc510
commit af367cd50c
9 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,7 @@
accessing
asDictionary
^ { 'profile-card-avatar' -> self profileImageFile fullName.
'profile-card-fullname' -> self name .
'profile-card-username' -> self userName .
'profile-bio' -> self profileBio } asDictionary

View File

@ -7,5 +7,6 @@ exportProfileImageOn: fileReference
file exists ifFalse: [ file ensureCreateFile ].
file binaryWriteStreamDo: [ :stream |
stream nextPutAll: profileImageUrl retrieveContents ].
profileImageFile := file.
super class inform: 'Exported as: ', String cr, file fullName.
^ file

View File

@ -0,0 +1,11 @@
accessing
exportWithTemplate: mustacheFile On: fileReference
| directory data mustacheDoc |
directory := fileReference parent.
data := self asDictionary.
self exportProfileImageOn:directory / userName, '-profileImage.jpg'.
mustacheDoc := mustacheFile asMustacheTemplate value: data.
MarkupFile
exportAsFileOn: (directory / (data at:'profile-card-username') asDashedLowercase , 'tex')
containing: mustacheDoc

View File

@ -0,0 +1,4 @@
accessing
profileBio
^ profileBio := (self documentTree xpath: '/html/body/div/div/div[2]/div[1]/div[2]/div[1]') stringValue

View File

@ -8,4 +8,5 @@ retrieveContents
createdAt;
url;
profileImageUrl;
profileBio;
yourself.

View File

@ -1,6 +1,6 @@
accessing
fromNitter: aDictionary
"created := (aDictionary at: 'pubDate') asDateAndTime."
created := (aDictionary at: 'pubDate') "asDateAndTime".
text := aDictionary at: 'text'.
"id := aDictionary at: 'id'.
authorId := aDictionary at: 'author_id'."

View File

@ -0,0 +1,3 @@
accessing
profileBio
^ profileBio

View File

@ -0,0 +1,3 @@
accessing
profileImageFile
^ profileImageFile

View File

@ -15,7 +15,9 @@
"tweets",
"createdAt",
"groups",
"url"
"url",
"profileImageFile",
"profileBio"
],
"name" : "TwitterUser",
"type" : "normal"