Skip to content

Commit

Permalink
extending checks to author stats
Browse files Browse the repository at this point in the history
  • Loading branch information
iaine committed Oct 30, 2024
1 parent 8af2128 commit 4df2676
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions datamodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,12 @@ function parseTiktok (header, data) {
}

authStats = 0;
likes = 0;
videos = 0;
if ('authorStats' in row['data'] && row['data']["authorStats"] != undefined) {
authStats = row['data']["authorStats"]["followerCount"];
likes = row['data']["authorStats"]["diggCount"];
videos = row['data']["authorStats"]["videoCount"]
}

const rows = {
Expand All @@ -304,8 +308,8 @@ function parseTiktok (header, data) {
"author": `"${user_nickname}"`,
"author_full": `"${user_fullname}"`,
"author_followers": authStats,
"author_likes": row['data']["authorStats"]["diggCount"],
"author_videos": row['data']["authorStats"]["videoCount"],
"author_likes": likes,
"author_videos": videos,
"author_avatar": row['data']['author']["avatarThumb"],
"body": `"${escapeHTML(row['data']["desc"])}"`,
"timestamp": new Date(parseInt(row['data']["createTime"] *1000)).toDateString(),
Expand Down

0 comments on commit 4df2676

Please sign in to comment.