Twitter Profile Image API deprecated - twitter

I am using Twitter API version 1 and replacing them to v1.1.
Then I cannot find users/profile_image/:screen_name API on version 1.1.
https://api.twitter.com/1/users/profile_image/shonanshachu
Does anyone know which API can be the best practice for replacing users/profile_image?
What I want is list of profile images or simple url with parameter of Twitter ID or screen name.

Maybe this will be useful for you. Those calls return all the info you need, including the image link. If you need only one user's image for a given user_id or user_screen, then you can read more from here:
https://dev.twitter.com/docs/user-profile-images-and-banners
https://api.twitter.com/1.1/followers/list.json (you can replace followers with friends)

I haven't found a great solution to this yet. The closest thing I have found is the twitter API 1.1 docs for users/show, but that is an authenticated call (requiring a user context) which is rate-limited (180 requests per 15 minutes). They mention this about getting the profile image url on the page about uploading a new photo:
You can either update your local cache the next time you request the
user's information, or, at least 5 seconds after uploading the image,
ask for the updated URL using GET users/show.
I imagine once the 1.0 API is shut off in March 2013, this question will get a lot of votes. :)
There are some hints that twitter is adding methods to their API to aid in retrieving images. We'll have to wait and see.

Related

YouTube API "mostPopular" requests doesn't seem to give updated results

It seems that the YouTube API doesn't give updated results for mostPopular videos in my country since few days.
Example:
This request (https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&chart=mostpopular&regionCode=FR) doesn't give me the same videos results than the ones displayed directly on YouTube for the French most popular channel (https://www.youtube.com/channel/UCmzy72gDEpfXoFV9Xdtd0DQ). It seems that the results of this request is not updated since the 1th of february. Results was real time updated before this.
Does someone know if something is wrong with my API request, or if there are some issues with the YouTube API at this moment?
There is nothing wrong with your request. This is a known issue with the YouTube API reported here for Saudi Arabia (but also applicable to multiple regions), and another related issue here with regard to content from France.
Your best bet would be to follow up with the YouTube team on one of those defects, or potentially (and dangerously) scrape the YouTube site for the correct results.
Problem seems to be solved since 13th of february (maybe someone from Google have seen my post..)
YouTube Channels and chart=mostPopular parameter data are separate data entities, aka you will get different results. They may be related but there is no guarantee you will get the same data. To get the data that you want you may need to query for channel itself and its videos.
I got this information from the thread #Jal linked, there was an update by matthewc...#google.com a few days ago:
The most popular channel for Saudia
Arabia and
the mostPopular chart parameter in the video.list
call
are separate and distinct entities. If you'd like to get the content
of the most popular channel for Saudia
Arabia
please use the Data API video.list call to list the videos with the
channel ID (in this case "UCWY-_j1MCth6yf24m58Bh_Q") by setting the
items/snippet/channelId parameter.
My current concern right now is that there is supposedly a way to get video information from the videos.list endpoint using a channelId, which does not seem the case in the API Explorer. I will update my answer once I figure out what this person meant exactly.

Twitter count with the new Twitter update

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.

twitter api 1.1 url count alternative

I've been using the old url api(v1) to get the count of a given url, lately I needed to get also the re-tweets and started searching about that.
this is the exact url I'm using right now:
http://urls.api.twitter.com/1/urls/count.json?url=http://google.com
As I viewed with some reading the v1 api is deprecated but at least it's still working.
I found some questions on the dev page of twitter:
https://dev.twitter.com/discussions/12643
those are a little old questions and have no specific solving to the problem. I mean, the most near solution was using the search api(search/tweets) which could be good but not a exactly replacement for the urls/count method.
Please note that Twitter's search service and, by extension, the
Search API is not meant to be an exhaustive source of Tweets. Not all
Tweets will be indexed or made available via the search interface.
also it has a limit for 100 results at maximum per 'page', even it throws the link to get the next set of objects, thats good but when the search reaches 1 million of results I'll need to get page over page to now how much tweets I got and having to do to much request to the api...
I sought some question over the dev page on twitter suggested using the stream api, I've tried using (statuses/filter) but that don't work very well given a URL as track param(which they said that is the keyword to track).
So, anyone who's been using the old urls/count has found a reliable alternative with the new apiv1.1, especiffically to get the tweets and re-tweets for a given url ?
The official suggestion by Twitter staff is that either the search/tweets endpoint (having just the last 7 days data) or the Streaming API be used (handling yourself the counters, making everything just too complicated for a d*mn counter).
As an extra warning, the old endpoint (http://urls.api.twitter.com/1/urls/count.json?url=YOUR_URL) will stop working on November 20th, and according to this blog post from Twitter there are no plans to replace it with anything in the short term and they are even removing the count from their own buttons.

How do I know if a specific twitter user is online or not?

How do I know if a specific twitter user is currently online by writing programs? Is there any API or data field in the web page showing this information? Both browsing Twitter webpage and using Twitter app are considered "online".
Although this information is not readily available, you can do a work around. Make use of Twitter's Streaming API: https://dev.twitter.com/docs/streaming-apis/streams/public (have a read through this document).
You'll most likely be using the POST Statuses/filter functionality (read the doc here: https://dev.twitter.com/docs/api/1/post/statuses/filter ), which will give you a JSON object with tweets based on your filters.
Make use of the parameters you'll need to specify in the URL to filter the stream (have a look through this document to learn more about it: https://dev.twitter.com/docs/streaming-apis/parameters ), in your case it'll be the follow parameter. You basically specify the twitter ID of the user you want to follow. Here's a sample JSON result of the streaming API in action https://stream.twitter.com/1/statuses/filter.json?follow=25365536 - this one in particular is following Kim Kardashian. Keep in mind that this will give you:
Tweets created by the user.
Tweets which are retweeted by the user.
Replies to any Tweet created by the user.
Retweets of any Tweet created by the user.
So in order to just stream the tweets of your desired user, you'll have to use a programming language of your choice to parse through the JSON object to find the user that actually sent the tweet (this is a little tricky, you'll have to look through the properties of the JSON object to figure it out). Once you narrow the streaming tweets to just the ones from the user though, you can then have an alert on when new tweets by this user stream and that will tell you if the user is online/using twitter at the moment.
It's not clear what you mean by "online" (browsing twitter.com? Using a Twitter app?), but in any case Twitter doesn't provide such information, thankfully.
I'm afraid such information is limited by Twitter and is not available. However you can put your question on https://dev.twitter.com/discussions and ask its developers. Good Luck
you need get user state first
then filter if around current time
then get ids
they are online
use twitter developer api
I do it for my website

How can I use the YouTube SUP API to retrieve recent uploads of some predefined users?

I wish to be able to check for the latest videos (in near realtime or at most a couple of minutes out) for a set of users (up to 200 or so) in a single call to the YouTube API and then store the IDs of uploaded videos in my own database. The only solution I believe there is for this is the YouTube SUP API but I'm not entirely clear on how it works and was wondering if someone could please explain it. I have read the entire API documentation on it but am still not completely clear.
I was assuming that one can call the SUP URL (http://gdata.youtube.com/sup) and check if the user hash has had any activity recently and if they have, then do something with that. My issue is I don't understand how you interpret the activity from ["b305e88","afd4"] in the SUP feed and is there any way to specify a subset of users or must you search through the entire feed? It seems to take a fair few seconds to load the SUP feed.
On the SUP API page it also states that you can visit a URL such as https://gdata.youtube.com/feeds/api/users/bbc/events?v=2 to obtain the hash key for a user's feed, but as you can see if you try to visit it, the link appears to be broken. How else could I obtain the hash?
I'm currently wanting to do this in a Rails project while using the youtube_it gem but I don't believe this has support for it. Correct me if I'm wrong.
Edit
My mistake. The developer key is required to obtain the events of a user such as https://gdata.youtube.com/feeds/api/users/bbc/events?v=2&key=YOUR_DEVELOPER_KEY
Still no progress with the SUP method although I'm potentially considering using a channel and just automatically subscribing to each user. Every minute I will then poll for the list of new videos by the users.
I'd suggest using PubSubHubbub: http://apiblog.youtube.com/2010/10/pubsubhubbub-for-youtube-activities.html
A handler in your web application will automatically receive a POST whenever one of the feeds you're watching is updated, and the content of the POST will be the updated feed itself, saving you the trouble of having to fetch it.
There isn't much documentation specific to using PuSH and the YouTube API beyond that blog post, but the general PuSH docs all apply: https://pubsubhubbub.appspot.com/
Failing that, SUP should still work, so we could try to debug that further if you'd rather use that.

Resources