Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
luoling8192 committed Mar 4, 2025
1 parent 6fbd133 commit d0582f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/twitter-services/src/parsers/tweet-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class TweetParser {
id,
text: text || '',
author,
timestamp,
timestamp: timestamp || new Date().toISOString(),
...stats,
}

Expand Down Expand Up @@ -130,12 +130,12 @@ export class TweetParser {

// Get display name
const displayNameElement = await authorElement.$('span:first-child')
const displayName = displayNameElement ? await displayNameElement.textContent() : 'Unknown User'
const displayName = displayNameElement ? await displayNameElement.textContent() || 'Unknown User' : 'Unknown User'

// Get username
const usernameElement = await authorElement.$('span a[href^="/"]')
let username = usernameElement ? await usernameElement.textContent() : 'unknown'
username = username.replace('@', '')
username = username?.replace('@', '') || 'unknown'

// Get avatar URL
const avatarElement = await tweetElement.$('img[src*="/profile_images/"]')
Expand Down

0 comments on commit d0582f2

Please sign in to comment.