Improving tweets parsing from nitter timeline item.
This commit is contained in:
parent
d9af46ec37
commit
a84e9504f9
@ -6,4 +6,5 @@ reStoreDefinition
|
|||||||
define: #created as: String;
|
define: #created as: String;
|
||||||
define: #authorId as: String;
|
define: #authorId as: String;
|
||||||
define: #timelines as: (Dictionary of: String -> String);
|
define: #timelines as: (Dictionary of: String -> String);
|
||||||
|
define: #metrics as: (Dictionary of: String -> String);
|
||||||
yourself
|
yourself
|
@ -18,11 +18,26 @@ fromNitterTimelineItem: xmlItem
|
|||||||
metricsTemp := Dictionary new .
|
metricsTemp := Dictionary new .
|
||||||
metricsTemp
|
metricsTemp
|
||||||
at: 'comment'
|
at: 'comment'
|
||||||
put: (xmlItem xpath: '//div[@class="icon-container"]') second stringValue trimmed;
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
||||||
|
select: [ :item | item asString includesSubstring: 'comment' ])
|
||||||
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
||||||
at: 'retweet'
|
at: 'retweet'
|
||||||
put: (xmlItem xpath: '//div[@class="icon-container"]') third stringValue trimmed;
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
||||||
|
select: [ :item | item asString includesSubstring: 'retweet' ])
|
||||||
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
||||||
at: 'quote'
|
at: 'quote'
|
||||||
put: (xmlItem xpath: '//div[@class="icon-container"]') fourth stringValue trimmed;
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
||||||
|
select: [ :item | item asString includesSubstring: 'quote' ])
|
||||||
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
||||||
at: 'heart'
|
at: 'heart'
|
||||||
put: (xmlItem xpath: '//div[@class="icon-container"]') fifth stringValue trimmed.
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
||||||
|
select: [ :item | item asString includesSubstring: 'heart' ])
|
||||||
|
stringValue trimmed) copyReplaceAll: ',' with: '').
|
||||||
metrics := metricsTemp.
|
metrics := metricsTemp.
|
||||||
|
|
||||||
|
metadata := Dictionary new.
|
||||||
|
metadata
|
||||||
|
at: 'pinned'
|
||||||
|
put: (((xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed) = 'Pinned Tweet'
|
||||||
|
ifTrue: [ True ]
|
||||||
|
ifFalse: [ False ])
|
Loading…
Reference in New Issue
Block a user