Twitter API, get Tweet as Image - twitter

I understand you can get the specific url of a tweet using the Twitter API by creating a url like this
https://twitter.com/username/status/tweet-id
However, is it possible to get an image of a tweet?
I can get media images, but those are just images that people posted in the tweet. I want to know if it is possible to get an image of the tweet itself.

Twitter's API includes the ability to do this with oembed.
https://dev.twitter.com/rest/reference/get/statuses/oembed

See https://opensourcelibs.com/lib/tweets-as-an-image
This project provides an API for downloading tweets as images: https://tweets-as-an-image.herokuapp.com/tweet?twitterHandle={your_twitter_handle}&id={your_tweet_id}&theme={light_or_dark}&maxwidth={max_width_of_your_tweet_image}&height={height_of_the_image}&lang={language}

Fast forward to 2023 - none of the one above seems to be available anymore.
This library worked flawlessly for me. It is not an web API but works well and has good options:
https://github.com/Xacnio/tweetcapture

You can now get images or screenshots of tweets using the #aissistant handle on twitter.
Retweet any tweet with the comment "#aissistant #image" to get an image.
Retweet any tweet with the comment "#aissistant #screenshot" to get a screenshot.
For other options like converting to memes and jokes check out the handle.
Full disclosure: I am creator of the bot behind the handle.

Related

How can I save tweets of a user as images?

There is a Twitter user who posts valuable stuff and I want to save his tweets not as text but as images (screenshots) just as you see it on your phone or computer.
I installed python-twitter and tweepy but I didn't find a solution in the docs and neither in communities so far.
Alternatively: Is there another way to save tweets in a kind of pretty, visually appealing way?
Thank you in advance.
With those libraries you can only extract Twitter data. Those aren't image processing libraries. You will have to write your own logic how you want those pictures displayed.
Look into Pillow.
I usually use this site called tweetcyborg.com It converts any tweet into an image.
I figured it out. Using Selenium Webdriver to open the Twitter account page in the browser, then scrape the tweets and use a screenshot tool to make an image. This looping through all tweets.

Search YouTube API without login in

I'm creating an app where i would like to display video result from the YouTube site.
However, i do not want the user to register for this.
After i registered my app, and allowed "YouTube Data Api", Still when i'm calling from my app:
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=3&order=relevance&q=test&regionCode=AR&type=video&key={MyKey}
I'm getting back "forbidden (403)"
This issue suppose to be really simple, but i'm really straggling to get this to work, i'm thinking maybe it has something to do with the new API version 3.0, that you can not search without authentication?
Any help would be much appreciated thanks.
You can use below URL for searching of youtube videos using version3
https://www.googleapis.com/youtube/v3/search?part=snippet&q=nokialumia&key=#"API _KEY"&maxResults=20&pageToken=0
For suggestions of you tube videos you can use below link. It will gives you the data in XML format. You can parse and get results.
http://suggestqueries.google.com/complete/search?output=toolbar&ds=yt&q=nokialumia
If you want to use Version 2 use below link
Youtube Search using version 2.0
Hope it helps you...!
What kind of results do you want to see? Views, comments, share, likes? I think that you are not able to see any results by Youtube Data Api or Youtube Analytics API V3 without a valid key. You can find all error codes and their meanings from this link.
I hope it helps.

How should I get all the tweets of an specific hashtag?

I'm trying to develop some code in order to get all the tweets that were generated with certain hashtags, then parse them and finally analyse them. I believe I've already thought and solve the last two parts of this but I'm having some trouble with the first one. I've already read the Twitter Search API documentation but I haven't realised yet how to do this. Can anyone help me?
If you want to retrieve the tweets sent recently, you should use the search/tweets endpoint of twitter' REST API, and mention the hashtag inside q parameter
In case you want to listen to tweets containing the hashtag and receive them in real time, then twitter's streaming API is what you should use (statuses/filter endPoint).
Have a look at the documentation on twitter's website, there's also plenty of information on how to do this all around the web.

Has Twitter removed the unauthenticated user RSS timeline feeds?

I have previously used the following URL to access my tweets and embed them on a website:
http://twitter.com/statuses/user_timeline/my_username.rss
It seems that just this morning though, I'm getting the following error:
Sorry, that page does not exist
Does anyone know what might have happened to this service, and what an alternative might be?
Try http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=USERNAME
It appears that this is a permanent change made by Twitter (see Twitter API's tweet)
Instead they're moving to a versioning system like below:
https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=twitter_username
By changing the user_timeline file extention you're able to receive the feed in different formats, IE:
https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=twitter_username
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter_username

How to add Twitter Expanded Tweets? (was: twitter media preview card for my site?)

I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn

Resources