Created
March 26, 2022 13:29
-
-
Save harihara6/1f907fc31afd33793084b735e3afd744 to your computer and use it in GitHub Desktop.
Get tweets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TwitterApi } from 'twitter-api-v2'; | |
const twitterClient = new TwitterApi(<Your twitter token>); | |
export async function getTweets() { | |
const client = twitterClient.readOnly; | |
const tweets = await client.v2.search('cricket', { | |
max_results:10, | |
"media.fields":'url,preview_image_url'}); | |
return tweets; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment