/twitter-direct-url

Get Twitter direct url from Tweet media link

Primary LanguageJavaScriptMIT LicenseMIT

Instalation :

> npm i --save twitter-url-direct

Example

const twitterGetUrl = require("twitter-url-direct")
let response = await twitterGetUrl("https://twitter.com/papajuiceman/status/1532425868521394178")
console.log(response)

Output Example - Video/Gif Tweet

{
    found: true,
    tweet_user: {
      name: 'Tweets of Cats',
      username: 'TweetsOfCats',
      text: 'https://t.co/3kKcSzCZvG'
    },
    type: 'video/gif',
    duration: 5.725,
    dimensionsAvailable: 2,
    download: [
      {
        witdh: '320',
        height: '566',
        dimension: '320x566',
        url: 'https://video.twimg.com/ext_tw_video/1547778885449707520/pu/vid/320x566/ZRiUXOvgiaYmC8tg.mp4?tag=12'
      },
      {
        witdh: '406',
        height: '720',
        dimension: '406x720',
        url: 'https://video.twimg.com/ext_tw_video/1547778885449707520/pu/vid/406x720/XuStSsCDx6NWjQeq.mp4?tag=12'
      }
    ]
}

Output Example - Image Tweet

{
    found: true,
    tweet_user: {
      name: 'cats who share one braincell',
      username: 'CATBRAINCELL',
      text: 'I drew a little bee kitty, instead of buzzing it purrs https://t.co/eCqxkvty98'
    },
    type: "image",
    download: "https://pbs.twimg.com/media/EvpS9B9WgAoim8w.jpg"
}

Output Example - Not Found Video/Image Tweet

{
    found: false,
    error: "Request failed with status code 404 or other messages"
}