Improving Nitter data extraction and rendering.
This commit is contained in:
parent
321ddc8e71
commit
f6b14c086d
4
Datanalitica.package/NitterUser.class/instance/url.st
Normal file
4
Datanalitica.package/NitterUser.class/instance/url.st
Normal file
@ -0,0 +1,4 @@
|
||||
accessing
|
||||
url
|
||||
^ url ifNil: [
|
||||
url := ((self documentTree xpath: '//div[@class="profile-website"]') // 'a' @@ 'href') first asUrl]
|
@ -1,6 +1,6 @@
|
||||
accessing
|
||||
asCardElement
|
||||
| aModeLook anEditor textInfoPane buttonsPane |
|
||||
| aModeLook anEditor textInfoPane buttonsPane webpageButton |
|
||||
|
||||
aModeLook := BrEditorModeAptitude new
|
||||
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
|
||||
@ -12,6 +12,11 @@ asCardElement
|
||||
text: self description;
|
||||
vFitContent.
|
||||
|
||||
webpageButton := BrButton new
|
||||
aptitude: BrGlamorousButtonWithLabelAptitude new;
|
||||
label: (self url asString copyReplaceAll: self url scheme, '://' with: '') allButLast;
|
||||
action: [ WebBrowser openOn: self url asString ].
|
||||
|
||||
textInfoPane := BrVerticalPane new
|
||||
hMatchParent;
|
||||
vFitContent;
|
||||
@ -26,8 +31,9 @@ asCardElement
|
||||
beLargeSize);
|
||||
addChild: (BrLabel new
|
||||
aptitude: BrGlamorousLabelAptitude;
|
||||
text: 'Joined: ' , self createdAtShorted );
|
||||
addChild: anEditor.
|
||||
text: 'Joined: ' , self createdAtShorted ).
|
||||
self url ifNotNil: [textInfoPane addChild: webpageButton].
|
||||
textInfoPane addChild: anEditor.
|
||||
buttonsPane := BrHorizontalPane new
|
||||
fitContent;
|
||||
cellSpacing: 5;
|
||||
|
@ -3,7 +3,7 @@ fromNitterProfile: userNameString
|
||||
| nitterUser joinDateString |
|
||||
nitterUser := NitterUser new userName: userNameString.
|
||||
name := nitterUser name.
|
||||
userName := NitterUser new userName: userNameString.
|
||||
userName := nitterUser userName.
|
||||
"((title splitOn: '/') second trimmed) allButFirst." "<--This should go to a test."
|
||||
profileImageUrl := nitterUser profileImageUrl.
|
||||
description := nitterUser description.
|
||||
|
@ -1,17 +1,7 @@
|
||||
accessing
|
||||
profileImage
|
||||
| response |
|
||||
response := ZnClient new url: (self profileImageUrl); get; response.
|
||||
response contentType = ZnMimeType imageJpeg
|
||||
ifTrue: [ | imageTemp |
|
||||
imageTemp := [ JPEGReadWriter gtFromBuffer: response contents ].
|
||||
^ BlUrlImageElement url: self profileImageUrl
|
||||
"The previous version has something like
|
||||
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
||||
^ imageTemp value asElement
|
||||
].
|
||||
response contentType = ZnMimeType imagePng
|
||||
ifTrue: [ | imageTemp |
|
||||
imageTemp := [ PNGReadWriter gtFromBuffer: response contents ].
|
||||
imageTemp on: Error do: [ ^ GtABContact new avatar ].
|
||||
^ imageTemp value asElement
|
||||
].
|
||||
^ BlElement new background: Color gray
|
||||
Should a generic avatar be reimplemented?"
|
3
Datanalitica.package/TwitterUser.class/instance/url.st
Normal file
3
Datanalitica.package/TwitterUser.class/instance/url.st
Normal file
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
url
|
||||
^ url
|
Loading…
Reference in New Issue
Block a user