fix: update socialdata

pull/685/head
Travis Fischer 2025-02-19 16:05:42 +07:00
rodzic 9a94be9b83
commit e71cb1bdb0
3 zmienionych plików z 26 dodań i 19 usunięć

Wyświetl plik

@ -132,7 +132,7 @@ async function main() {
const exa = new ExaClient()
const res = await exa.search({
query: 'OpenAI',
category: 'fodojdifjoidfj'
category: 'linkedin profile'
})
console.log(JSON.stringify(res, null, 2))

Wyświetl plik

@ -94,29 +94,30 @@ export namespace socialdata {
tweet_created_at: string
id: number
id_str: string
text: any
text: string | null
full_text: string
source: string
truncated: boolean
in_reply_to_status_id: any
in_reply_to_status_id_str: any
in_reply_to_user_id: any
in_reply_to_user_id_str: any
in_reply_to_screen_name: any
in_reply_to_status_id: number | null
in_reply_to_status_id_str: string | null
in_reply_to_user_id: number | null
in_reply_to_user_id_str: string | null
in_reply_to_screen_name: string | null
user: User
quoted_status_id: any
quoted_status_id_str: any
lang: string
quoted_status_id: number | null
quoted_status_id_str: string | null
is_quote_status: boolean
quoted_status: any
retweeted_status: any
is_pinned: boolean
quote_count: number
reply_count: number
retweet_count: number
favorite_count: number
lang: string
entities: Entities
views_count: number
bookmark_count: number
quoted_status: Tweet | null
retweeted_status: Tweet | null
entities: Entities
}
export interface User {
@ -125,7 +126,7 @@ export namespace socialdata {
name: string
screen_name: string
location: string
url: any
url: string | null
description: string
protected: boolean
verified: boolean
@ -141,10 +142,12 @@ export namespace socialdata {
}
export interface Entities {
user_mentions?: any[]
urls?: any[]
user_mentions?: any[]
hashtags?: any[]
symbols?: any[]
media?: any[]
timestamps?: any[]
}
export interface UserFollowingStatus {

Wyświetl plik

@ -94,10 +94,12 @@ export function getPrunedTweet(
): Partial<types.Tweet> {
const urls = tweet.entities?.urls
let text = tweet.text
if (text && urls) {
for (const url of urls) {
if (!url.expanded_url || !url.url) continue
text = text!.replaceAll(url.url, url.expanded_url!)
if (url.expanded_url && url.url) {
text = text!.replaceAll(url.url, url.expanded_url!)
}
}
}
@ -119,10 +121,12 @@ export function getPrunedTwitterUser(
): Partial<types.TwitterUser> {
const urls = twitterUser.entities?.description?.urls
let description = twitterUser.description
if (description && urls) {
for (const url of urls) {
if (!url.expanded_url || !url.url) continue
description = description!.replaceAll(url.url, url.expanded_url!)
if (url.expanded_url && url.url) {
description = description!.replaceAll(url.url, url.expanded_url!)
}
}
}