On Twitter, Media entities consistently provide users with thumbnail images instead of videos or gifs

When I look at this tweet, the media entity I receive is:

{
  id: 1291683183411437600,
  id_str: '1291683183411437568',
  indices: [ 149, 172 ],
  media_url: 'http://pbs.twimg.com/tweet_video_thumb/Eez7Av2VoAAK58T.jpg',
  media_url_https: 'https://pbs.twimg.com/tweet_video_thumb/Eez7Av2VoAAK58T.jpg',
  url: 'STACKOVERFLOW TOLD ME TO REMOVE THIS URL',
  display_url: 'pic.twitter.com/I3Clni8MeD',
  expanded_url: 'https://twitter.com/_Weeekly/status/1291683199240695809/photo/1',
  type: 'photo',
  sizes: {
    thumb: { w: 150, h: 150, resize: 'crop' },
    medium: { w: 846, h: 1200, resize: 'fit' },
    large: { w: 1024, h: 1452, resize: 'fit' },
    small: { w: 480, h: 680, resize: 'fit' }
  }
}

The function I am using for this task is as follows:

let params = {
    screen_name: tweeter.tweeter,
    since_id: parseInt(tweeter.latestTweetId),
    include_rts: true,
    tweet_mode: "extended",
    count: 1000
};
twitterClient.get("statuses/user_timeline", params, async function (
    error,
    tweets
) { 
       //code
}

Is there a way to extract the gifs/video links from the user_timeline data?

Answer №1

Be sure to inspect the media component located within the extended_entities section of the Tweet.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Show values in currency format with two decimal places

Is there a way to convert numbers like 1499 into 14.99 in jQuery? The raw numbers will always end in "99," such as "1999", "2499", "9999". I've come across code that rounds or assumes there are no decimals, but that's not what I need. var num = ...

The typing library for Angular does not properly identify the JQueryStatic object

Encountered an issue with the Angular declaration file: Error TS2304: Cannot locate identifier 'JQueryStatic'. The typings for jQuery are installed and properly declare JQueryStatic as an interface. Looking for solutions to resolve this error. ...

Transforming a vertical table into a horizontal layout

I'm facing an issue with transforming the database object for table display. My database contains a table structured like this. name total date Awoc1 100 9/14/2022 Awoc1 200 9/15/2022 Awoc1 300 9/16/2022 Awoc2 100 9/14/2022 Awoc2 ...

Convert a list into a hierarchical structure of nested objects

Working with angular, I aim to display a nested tree structure of folders in an HTML format like below: <div id="tree"> <ul> <li ng-repeat='folder in folderList' ng-include="'/templates/tree-renderer.html'" ...

Ways to retrieve the ref attribute's value

Can you help me retrieve the value wwww from the ref attribute? <form @submit.prevent enctype="multipart/form-data"> <input type="file" ref="wwww" @change="selectFile"> </form> I have tried the ...

Issues with slider functionality in a Next.js application styled with Tailwind CSS

"use client"; import React, { useState } from "react"; const textData = [ { id: 1, text: "Text 1 Description", }, { id: 2, text: "Text 2 Description", }, { id: 3, text: "Text 3 ...

Creating a multitude of cubes by iterating through the pixel color data of getImageData in Three.js

Using a simple 3x3.png file to extract color/opacity data from, where each of the 9 pixels represents a different color/opacity level. The .png is supposed to be loaded onto an off-screen canvas, following which the 9 cubes are drawn in a 3x3 grid pattern ...

What is the process for extracting information from a middleware within a Next.js framework?

I have been working on developing an authentication system using JWT in Next.js. In order to achieve this, I created a middleware that can validate the JWT token and establish an authentication process as shown below: export default function middleware(req ...

"Error" - The web service call cannot be processed as the parameter value for 'name' is missing

When using Ajax to call a server-side method, I encountered an error message: {"Message":"Invalid web service call, missing value for parameter: \u0027name\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(O ...

Attaching a $UI element to a <div> tag with JQuery may result in unexpected errors and issues

Attempting to connect SagePayments card elements to the paymentDiv. Followed their sample project for guidance, but encountering issues with populating the elements when running the program with a custom Sandbox merchantID and merchantKey. Chrome's de ...

Tips on embedding d3 into an HTML document

I am new to D3 and I would like to incorporate a simple line chart right after the table in my index.html file. <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="sheet.css"> <script src="jquery-1.1 ...

Client-side rendering for NextJS server components is also supported

I am currently working with Material UI v5.11.16 in a nextjs environment using v13.3.0. I followed the official documentation setup for my nextjs project which can be found here. So far, I have successfully integrated Material UI components without having ...

Struggling to transfer data into MySQL database with AJAX and PHP

I am attempting to store user-input text from an input field into a MySQL database using Ajax and PHP. The concept is to input the text, click 'display', and then retrieve it from the database to display on the page. Here's a snippet of the ...

Mobx is unable to resolve the observable property decorator

I'm looking to implement a mobx observable with the data type of map. Here is how I am decorating the map: @observable.map items: Map<number, Item> = new Map(); However, upon doing this, I encounter the following error message: the return type ...

Experience a login page similar to Google's with a fully functional back button

I'm currently working on a login page that requires the user to enter their username and have it validated before proceeding. Once the username is confirmed as valid, a new input field for password entry should appear. However, I'm facing an issu ...

What is the process for configuring ng e2e to run on a specific port?

Ever since moving to Angular 6, I've noticed that ng e2e is no longer able to run on an available port like it used to. In the past, when we were using Angular 4, the app service would be on port 4200 and running ng e2e would automatically select a fr ...

Redux and MongoDB do not instantiate a fresh document

When creating the initial order, I encounter an issue where I am unable to place a new order afterwards. The server returns a 404 error ":5006/api/orders:1 Failed to load resource: the server responded with a status of 404 (Not Found) apiRequests.js?t ...

JavaScript form validation eliminates input data

I recently started using the JavaScript library for client-side form validation called Bouncer. It has been working really well, but I have encountered a peculiar behavior that I need help understanding. My form has two submit buttons with different value ...

Leveraging the NPX command for executing a shell script with shebang/interpreter

Is it possible to execute a command line script using the coffee executable by calling it through npx? I attempted to use #!/usr/bin/env npx coffee, but this method does not work as only one argument is supported with env. Are there any alternatives for ...

Creating a Fresh Instance in JavaScript: Different Methods

As per the information provided in this MSDN article - specifically focusing on Constructor Functions but No Classes, (and after consulting the MDN JS reference) I attempted to create an object using the following code: function Dog(name){ this.name = ...