Improving NitterUser and Tweet from nitter information.
This commit is contained in:
parent
a1519fc510
commit
af367cd50c
@ -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 exists ifFalse: [ file ensureCreateFile ].
|
||||||
file binaryWriteStreamDo: [ :stream |
|
file binaryWriteStreamDo: [ :stream |
|
||||||
stream nextPutAll: profileImageUrl retrieveContents ].
|
stream nextPutAll: profileImageUrl retrieveContents ].
|
||||||
|
profileImageFile := file.
|
||||||
super class inform: 'Exported as: ', String cr, file fullName.
|
super class inform: 'Exported as: ', String cr, file fullName.
|
||||||
^ file
|
^ 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;
|
createdAt;
|
||||||
url;
|
url;
|
||||||
profileImageUrl;
|
profileImageUrl;
|
||||||
|
profileBio;
|
||||||
yourself.
|
yourself.
|
@ -1,6 +1,6 @@
|
|||||||
accessing
|
accessing
|
||||||
fromNitter: aDictionary
|
fromNitter: aDictionary
|
||||||
"created := (aDictionary at: 'pubDate') asDateAndTime."
|
created := (aDictionary at: 'pubDate') "asDateAndTime".
|
||||||
text := aDictionary at: 'text'.
|
text := aDictionary at: 'text'.
|
||||||
"id := aDictionary at: 'id'.
|
"id := aDictionary at: 'id'.
|
||||||
authorId := aDictionary at: 'author_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",
|
"tweets",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"groups",
|
"groups",
|
||||||
"url"
|
"url",
|
||||||
|
"profileImageFile",
|
||||||
|
"profileBio"
|
||||||
],
|
],
|
||||||
"name" : "TwitterUser",
|
"name" : "TwitterUser",
|
||||||
"type" : "normal"
|
"type" : "normal"
|
||||||
|
Loading…
Reference in New Issue
Block a user