File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1- import { addApiParams , requestApi } from './api' ;
1+ import { addApiParams , requestApi , bearerToken2 } from './api' ;
22import { TwitterAuth } from './auth' ;
33import { TimelineV1 } from './timeline-v1' ;
44
@@ -11,9 +11,14 @@ export async function getTrends(auth: TwitterAuth): Promise<string[]> {
1111 params . set ( 'include_page_configuration' , 'false' ) ;
1212 params . set ( 'entity_tokens' , 'false' ) ;
1313
14+ // Use bearerToken2 for trends endpoint
1415 const res = await requestApi < TimelineV1 > (
1516 `https://api.x.com/2/guide.json?${ params . toString ( ) } ` ,
1617 auth ,
18+ 'GET' ,
19+ undefined ,
20+ undefined ,
21+ bearerToken2 ,
1722 ) ;
1823 if ( ! res . success ) {
1924 throw res . err ;
Original file line number Diff line number Diff line change @@ -121,9 +121,14 @@ export async function fetchTweets(
121121 userTweetsRequest . variables [ 'cursor' ] = cursor ;
122122 }
123123
124+ // Use bearerToken2 for UserTweets endpoint
124125 const res = await requestApi < TimelineV2 > (
125126 userTweetsRequest . toRequestUrl ( ) ,
126127 auth ,
128+ 'GET' ,
129+ undefined ,
130+ undefined ,
131+ bearerToken2 ,
127132 ) ;
128133
129134 if ( ! res . success ) {
@@ -374,9 +379,15 @@ export async function getTweet(
374379 const tweetDetailRequest = apiRequestFactory . createTweetDetailRequest ( ) ;
375380 tweetDetailRequest . variables . focalTweetId = id ;
376381
382+ // Use bearerToken2 for this specific endpoint (TweetDetail)
383+ // This is required for animated GIFs to appear in tweets with mixed media
377384 const res = await requestApi < ThreadedConversation > (
378385 tweetDetailRequest . toRequestUrl ( ) ,
379386 auth ,
387+ 'GET' ,
388+ undefined ,
389+ undefined ,
390+ bearerToken2 ,
380391 ) ;
381392
382393 if ( ! res . success ) {
You can’t perform that action at this time.
0 commit comments