[go: nahoru, domu]

Skip to content

Instantly share code, notes, and snippets.

@harihara6
Created March 26, 2022 13:29
Show Gist options
  • Save harihara6/1f907fc31afd33793084b735e3afd744 to your computer and use it in GitHub Desktop.
Save harihara6/1f907fc31afd33793084b735e3afd744 to your computer and use it in GitHub Desktop.
Get tweets
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