Skip to content

Commit 61e6858

Browse files
committed
Updating expanded URL
1 parent a3199f4 commit 61e6858

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

datamodel.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ function parseTwitter (header, data) {
3737
if (row["data"]["legacy"]["entities"]["hashtags"]) {
3838
row["data"]["legacy"]["entities"]["hashtags"].forEach( t => tags.push(t.text))
3939
}
40+
let extended = [];
41+
if (row["data"]["legacy"]["entities"]["media"]) {
42+
row["data"]["legacy"]["entities"]["media"].forEach(x => extended.push(x['expanded_url']))
43+
}
44+
console.log(row["data"]["legacy"]["entities"]["media"]["expanded_url"]);
45+
console.log(extended);
4046
const rows = {"id": row["data"]["rest_id"],
4147
"thread_id": row["data"]["legacy"]["conversation_id_str"],
4248
"timestamp": dt.getFullYear() + "-" + dt.getMonth() + "-" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds(),
@@ -61,7 +67,8 @@ function parseTwitter (header, data) {
6167
"is_reply": (row["data"]["legacy"]["conversation_id_str"].toString() != row["data"]["rest_id"].toString()) ? "yes" : "no",
6268
"replied_user": (row["data"]["legacy"]["in_reply_to_screen_name"])? row["data"]["legacy"]["in_reply_to_screen_name"]: "",
6369
"hashtags": (tags.length > 0) ? tags.join(";") : "",
64-
"urls": (row["data"]["legacy"]["entities"]["urls"]["expanded_url"]) ? row["data"]["legacy"]["entities"]["urls"]["expanded_url"].join(';').toString():"",
70+
"urls": (extended.length > 0) ? extended.join(";") : "",
71+
//"urls": (row["data"]["legacy"]["extended_entities"]["media"]["expanded_url"]) ? row["data"]["legacy"]["extended_entities"]["media"]["expanded_url"].join(';').toString():"",
6572
"images": (photos.length > 0) ? photos.join(";") : "",
6673
"videos": (videos.length > 0) ? videos.join(";") : "",
6774
"mentions": (mentions.length > 0) ? mentions.join(";") : "",

0 commit comments

Comments
 (0)