fix: update socialdata

old-agentic
Travis Fischer 2025-02-19 16:05:42 +07:00
rodzic 3cdfe12090
commit efb6960da4
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 exa = new ExaClient()
const res = await exa.search({ const res = await exa.search({
query: 'OpenAI', query: 'OpenAI',
category: 'fodojdifjoidfj' category: 'linkedin profile'
}) })
console.log(JSON.stringify(res, null, 2)) console.log(JSON.stringify(res, null, 2))

Wyświetl plik

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

Wyświetl plik

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