2022-04-07 19:17:17 +00:00
|
|
|
accessing
|
|
|
|
fromNitterTimelineItem: xmlItem
|
2022-04-09 03:02:27 +00:00
|
|
|
| author authorAndId metricsTemp timeTemp |
|
2022-04-07 19:17:17 +00:00
|
|
|
authorAndId := (((xmlItem xpath: '//a[@class="tweet-link"]')
|
|
|
|
asString splitOn: 'href="' ) second splitOn: '/') reject: [ :i | i isEmpty or: [i = '>)']].
|
|
|
|
author := authorAndId first.
|
|
|
|
user := NitterUser new
|
|
|
|
userName: author .
|
2022-04-09 03:02:27 +00:00
|
|
|
|
|
|
|
timeTemp := (((xmlItem xpath: '//span[@class="tweet-date"]')asString splitOn: 'title="') second splitOn: '">')first.
|
|
|
|
timeTemp := ((timeTemp copyReplaceAll: ' · ' with: ' ') copyReplaceAll: 'UTC' with: '+00:00') asDateAndTime.
|
|
|
|
created := timeTemp.
|
|
|
|
|
|
|
|
text := (xmlItem xpath: '//div[@class="tweet-content media-body"]')stringValue.
|
2022-04-07 19:17:17 +00:00
|
|
|
id := authorAndId last copyReplaceAll: '#m"' with: ''.
|
2022-04-09 03:02:27 +00:00
|
|
|
authorId := self user id.
|
|
|
|
|
|
|
|
metricsTemp := Dictionary new .
|
|
|
|
metricsTemp
|
|
|
|
at: 'comment'
|
2022-04-09 04:50:31 +00:00
|
|
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
|
|
|
select: [ :item | item asString includesSubstring: 'comment' ])
|
|
|
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
2022-04-09 03:02:27 +00:00
|
|
|
at: 'retweet'
|
2022-04-09 04:50:31 +00:00
|
|
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
|
|
|
select: [ :item | item asString includesSubstring: 'retweet' ])
|
|
|
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
2022-04-09 03:02:27 +00:00
|
|
|
at: 'quote'
|
2022-04-09 04:50:31 +00:00
|
|
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
|
|
|
select: [ :item | item asString includesSubstring: 'quote' ])
|
|
|
|
stringValue trimmed) copyReplaceAll: ',' with: '');
|
2022-04-09 03:02:27 +00:00
|
|
|
at: 'heart'
|
2022-04-09 04:50:31 +00:00
|
|
|
put: ((((xmlItem xpath: '//div[@class="icon-container"]')
|
|
|
|
select: [ :item | item asString includesSubstring: 'heart' ])
|
|
|
|
stringValue trimmed) copyReplaceAll: ',' with: '').
|
|
|
|
metrics := metricsTemp.
|
|
|
|
|
|
|
|
metadata := Dictionary new.
|
|
|
|
metadata
|
|
|
|
at: 'pinned'
|
|
|
|
put: (((xmlItem xpath: '//div[@class="pinned"]') stringValue trimmed) = 'Pinned Tweet'
|
2022-04-10 00:31:10 +00:00
|
|
|
ifTrue: [ true ]
|
|
|
|
ifFalse: [ false ])
|