Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

Fetch tweets

const token = process.env["TWITTER_BEARER_TOKEN"]

const fetchTweetsFromUser = (userName: string) => {
  const url = `https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=${userName}&count=20`
  return fetch(url, {
    headers: {
      "Authorization": `Bearer ${token}`
    }
  })
    .then(res => res.json())
    .then(tweets => tweets.map(tweet => ({
      id: tweet.id,
      text: tweet.text,
      created_at: tweet.created_at,
      user: {
        id: tweet.user.id,
        name: tweet.user.name,
        screen_name: tweet.user.screen_name,
        profile_image_url: tweet.user.profile_image_url
      }
    })))
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: typescript vite static assets 
Typescript :: typescript how to define class properties to empty 
Typescript :: asciidots helloworld 
Typescript :: typescript ingerit 
Typescript :: ts remainder of Division 
Typescript :: components of loadrunner 
Typescript :: path represents file or directory java 
Typescript :: No provider for ChildrenOutletContexts! 
Typescript :: sort even dont exists meta wordpress 
Typescript :: puts with details ruby 
Typescript :: function permutations() kalibrr 
Typescript :: remove white border around components angular 
Typescript :: read and write objects in cpp 
Typescript :: typescript onchane event 
Typescript :: Convert the array of objects to object iterable 
Typescript :: how to add typescript tp create react app 
Typescript :: What is the reason we are using properties file 
Typescript :: how to print selected elements from a list 
Typescript :: can we use function overloading and default arguments at same time in c++ 
Typescript :: are flights still running 
Typescript :: Modify the program so it also prints the number of A, T, C, and G characters in the sequence in python 
Typescript :: angular build failed to load router-outlet 
Typescript :: how many bits are there in a hexadecimal digit 
Typescript :: inteface method extension angular 
Typescript :: how to let a textview take 75 percent of its parent width android xml 
Typescript :: why table columns are messing in one another in angular 
Typescript :: test plan vs qa plan 
Typescript :: usually placed in footer 
Typescript :: if a directive called 10000 times screen getting struck 
Typescript :: testing with limited information 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =