I'm currently using the script..
http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1
.. to pull the most recent Tweet for a number of users to display on my website. However, I've ran into the problem that the JSON format doesn't display Retweets. I've read from this link that you must use "retweeted_by_me" to also display Retweets by I'm not quite sure how I would merge that with my current script.
EDIT : As of Twitter API Version 1.1, use the following format. (Needs Authenticaton)
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
The updated documentation can be found here
https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
[UPDATE] The following methods apply to Twitter API Version 1 and is Deprecated now.
Use the new twitter API and add include_rts=true Eg: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
Full documentation can be found here : http://dev.twitter.com/doc/get/statuses/user_timeline
If you read the GET statuses/user_timeline documentation you fill find that by adding a parameter of include_rts set to true it will include retweets.
Change response mode to rss. This will resolve the issue. It might require change in the display code depending on your scripting language though.
Related
I have an odd problem with my twitter account. Basically I'm generating tweets automatically via a plugin with my WordPress website. That works but the tweets appear twice. I believe this isn't that the plugin is posting twice but want to be sure and just wondered if theres a way I can see technical details about the origin of a tweet?
In the JSON for each tweet there is a source field that shows the utility used to post the tweet. Example from the REST API documentation:
"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/us\/app\/twitter\/id409789998?mt=12\" rel=\"nofollow\"\u003ETwitter for Mac\u003C\/a\u003E"
Also, check the timestamps for each tweet to see how far apart they're being posted. Twitter checks each tweet against the last status posted, and duplication attempts are supposed to be blocked with a 403 error at the statuses/update.json endpoint. Are your duplicated statuses exactly the same? I'd start to check for the problem by comparing each tweet's JSON and seeing if there are any differences.
As of today, its not possible to fetch tweet counts. You can read more here:
https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform
So almost all scripts/plugins wont work anymore. What would be best alternative solution with the new twitter buttons/updated API, if such exists?
For example, is there a callback, once user successfully shares something? Because i could use that to increase tweet count in my own database? So saving them locally.
To answer my own question based on findings:
For now its possible via http://opensharecount.com, they provide a drop-in replacement for the old private JSON URL based on searches made via the API (so you don't need to do all that work).
It's based on the REST API Search endpoints.
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.
I am trying to get the full list of videos uploaded by a user.
I am using the following url:
https://gdata.youtube.com/feeds/api/users/username/uploads?v2&alt=json
And using curl in php to get the contents.
But I am getting only 25 results. If I use the max-results, the max is 50.
What should I use in order to get the whole list?
After replacing 'username' with a valid name the response shows a url link for the next request in the response you get. Look for: {"rel":"next","type":"application/atom+xml","href":"https://gdata.youtube.com/feeds/api/users/username/uploads?alt=json&start-index=26&max-results=25"}
As you can see another parameter is added: 'start-index'. Which you also can add yourself
BTW. I assume you know there is a typing error in your example. You set the version parameter by using 'v=2' instead of 'v2'.
I suggest using YouTube Data API v3 for this purpose.
You can get to use PHP examples in YouTube API Samples project.
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