Add `bookmark_count` and `view_count` to the X / Twitter extractor

- Parse `view_count` as integer in Twitter extractor
- Style fix
- optimize 'view_count' extraction
pull/5802/head
rameerez 3 months ago committed by Mike Fährmann
parent ea81fa985f
commit ee93dfeb8d
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -321,8 +321,17 @@ class TwitterExtractor(Extractor):
"quote_count" : tget("quote_count"), "quote_count" : tget("quote_count"),
"reply_count" : tget("reply_count"), "reply_count" : tget("reply_count"),
"retweet_count" : tget("retweet_count"), "retweet_count" : tget("retweet_count"),
"bookmark_count": tget("bookmark_count"),
} }
if "views" in tweet:
try:
tdata["view_count"] = int(tweet["views"]["count"])
except Exception:
tdata["view_count"] = 0
else:
tdata["view_count"] = 0
if "note_tweet" in tweet: if "note_tweet" in tweet:
note = tweet["note_tweet"]["note_tweet_results"]["result"] note = tweet["note_tweet"]["note_tweet_results"]["result"]
content = note["text"] content = note["text"]

Loading…
Cancel
Save