Improving NitterUser and Tweet from nitter information.
This commit is contained in:
parent
a1519fc510
commit
af367cd50c
Datanalitica.package
NitterUser.class/instance
Tweet.class/instance
TwitterUser.class
@ -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
|
@ -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
|
@ -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
|
@ -0,0 +1,4 @@
|
||||
accessing
|
||||
profileBio
|
||||
|
||||
^ profileBio := (self documentTree xpath: '/html/body/div/div/div[2]/div[1]/div[2]/div[1]') stringValue
|
@ -8,4 +8,5 @@ retrieveContents
|
||||
createdAt;
|
||||
url;
|
||||
profileImageUrl;
|
||||
profileBio;
|
||||
yourself.
|
@ -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'."
|
||||
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
profileBio
|
||||
^ profileBio
|
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
profileImageFile
|
||||
^ profileImageFile
|
@ -15,7 +15,9 @@
|
||||
"tweets",
|
||||
"createdAt",
|
||||
"groups",
|
||||
"url"
|
||||
"url",
|
||||
"profileImageFile",
|
||||
"profileBio"
|
||||
],
|
||||
"name" : "TwitterUser",
|
||||
"type" : "normal"
|
||||
|
Loading…
Reference in New Issue
Block a user