Change tiny urls to expanded url inside tweet - url

I am getting Twitter tweets in my website using v1.1 user timeline API, but the problem is the URLs tweeted are displaying in short form like t.co... format.
Now I want to display expanded URL instead of tiny URLs, so how can I can do this? Please give me a solution.
Note: I referred Simplest PHP example for retrieving user_timeline with Twitter API version 1.1, this questions in stackoverflow for getting tweets.

Related

Using Twitter API to embed tweets with URL

I'm trying to embed tweets in my app by passing in a tweets URL. I'm completely inexperienced with APIs and need a bit of guidance to set it up. Twitter has some documentation here and here on how to do it using Oembed. The part I'm unclear on is how to make a request:
"Make a request to the following URL for each Tweet ID, where {tweet_id} represents the value changing in a programmatic loop:"
https://api.twitter.com/1.1/statuses/oembed.{format}
Also unsure on where to add the API keys Twitter gives me. Sorry for the broad question, very new at this.

Get only tweets with Pictures using twitter search api

This question has already been asked there : Get Tweets with Pictures using twitter search api
But it's obsolete now : the new Twitter API doesn't allow the answer provided.
In a nutshell : I'm trying, in Ajax, to retrieve tweets with a particular hashtag that contains a media (image).
It rather depends on the source of the images that you want to find. You are best of searching for the URL of the image directly.
If you're looking for images uploaded directly to Twitter with the hashtag "#nice", do a search for twimg%20%26%20%23nice (that's "twimg & #nice").
You could also include flickr or any other image sharing service.

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.

how to find out when a link was first tweeted

http://isitold.com/ somehow determines when a link/url was first tweeted. I can't seem to figure out how to do this with the twitter api, does anybody know?
I'd like to use when a link was first tweeted in a time decay function in my app.
You can search tweets with this link using the Twitter Search API to retrieve the oldest tweet possible.
Seems like twitter does not provide historical tweets (search api will not work).
You can get access to historical tweet information with a service like Topsy http://www.topsy.com http://code.google.com/p/otterapi/ (api on topsy).
I have written Who Tweeted It First using YQL and JS to find the oldest tweet for any topic. It is essentially scraping data from the Twitter search page as the official API doesn't return the previous tweets.

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