Skip to content

Commit

Permalink
CSV improvements
Browse files Browse the repository at this point in the history
This release adds the full text of retweets (using
.retweeted_status.full_text rather than .full_text). It also adds a
quote_id column for tweets that are quoting another tweet.

refs #105
  • Loading branch information
edsu committed Aug 23, 2021
1 parent b4fe9ec commit b2f3592
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app/utils/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export function toCsv(jsonPath, csvPath) {
'lang',
'place',
'possibly_sensitive',
'quote_id',
'retweet_count',
'retweet_id',
'retweet_screen_name',
Expand Down Expand Up @@ -229,11 +230,12 @@ function csvRow(t) {
t.lang,
place(t),
t.possibly_sensitive,
t.quoted_status_id_str,
t.retweet_count,
retweetId(t),
retweetScreenName(t),
t.source,
t.full_text,
text(t),
tweetUrl(t),
u.created_at,
u.screen_name,
Expand All @@ -253,6 +255,14 @@ function csvRow(t) {
]
}

function text(t) {
if (t.retweeted_status) {
return t.retweeted_status.full_text
} else {
return t.full_text
}
}

function coordinates(t) {
if (t.coordinates) {
return t.coordinates.coordinates
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydrator",
"version": "0.1.0",
"version": "0.2.0",
"description": "A desktop utility to hydrate Twitter ID datasets.",
"main": "init.js",
"author": {
Expand Down

0 comments on commit b2f3592

Please sign in to comment.