YouTube API - live broadcasts ordered by current viewers? - youtube-api

I need to get a list of current live broadcasts in a given category from the YouTube Data API, ordered by number of viewers currently watching.
It looks like the liveStreamingDetails (which contains the concurrentViewers property) are only exposed on the individual video level. However, grabbing all the current streams, then making separate calls for each stream to get the number of viewers, then ordering that list is woefully inefficient and costly.
Feels like there must be a better way! Any ideas?

Currently there is no better way. Please file a feature request at https://code.google.com/p/gdata-issues/issues/list?q=label:APi-YouTube to keep track.

Related

How to walk throuh youtube?

I am curious to know what would be the most efficient way to walk the youtube website. My goal is to eventually index all videos on youtube (hypothetically) and the only way I can think of is to go channel by channel indexing all of the videos. I am not very familiar with the v3 APi, so if there is a better way to accomplish this, please let me know. This gives rise to a few problems I can think of:
Where to begin? Channels and videos are accessed using random string IDs, so if I simply start with IDs beginning with 'A' I am going to run into a lot of null values. Not sure how IDs are assigned, but this also may keep the indexing in a certain segment/section of video types if it is based on the ID alphanumerics.
I am hoping to move methodically through the youtube directory, trying to avoid accidently indexing the same channel/video.
Should I somehow seperate the videos into groups and request them based on other parameters? A grouped scheme may be easier to work with, update, etc.
I won't know if the video has anything I am interested in indexing before accessing it.
First you need to understand that there are way too many videos for you to do this without having access to the stack directly, which you do not have and will not get.
As to automate the selection of video's, you can try to use the video ID's.
They are 11 characters long, consisting of only "a-z A-Z _ and - " . So that would reduce (still is 54 to the power of 11) the indexing/scanning if a video exists. Then save that ID (with related info) and move on.
Not a perfect option, but best I can see with your options and requirements.

is it allowed to save meta data about youtube videos in local databases

Is it allowed to save meta-data like video lengths, keywords and specific event information at certain point in time in the video?
For example, there is a movie trailer and I want to save the point in the video where a certain event occurs in my own database.
If the information is being used in conjunction with the YouTube api/player, then there is no problem as you are just creating shortcuts to an evet.
If you are not sure, then you can read the YouTube terms of service for an in depth answer.

Can YouTube IDs be reissued after a video is deleted?

Suppose I have a video on YouTube that gets the URL https://www.youtube.com/watch?v=vWSyMuKkXXX (not a real video/ID, fwiw). If I delete that video, what are the chances that "vWSyMuKkXXX" will get reassigned to another video that somebody else puts up? 62^11 (is that right?) is a pretty large space from which to be assigning symbols, but YouTube must be doing some uniqueness test to avoid duplicates. The question, I guess, would then be whether they're including deleted IDs in that test (at least, given the way I'm guessing what they're doing internally).
This question is all about how much work I have to do to figure out whether the video corresponding to an ID exists and that it is the video that I think it is -- whether I can get away with using a simple call to http://www.youtube.com/oembed?... , or whether I need to get authentication and the APIs involved (which might still not resolve the question). Any thoughts? Thanks!
If YouTube were to ever reuse IDs, it would cause problems such as old links now pointing to new (possibly unlisted) videos. There is no advantage in reusing IDs, only problems including privacy problems. It would be an ugly bug.
To support unlisted videos, the IDs cannot be sequential. They must come from a large space of possible values.
how much work I have to do to figure out whether the video corresponding to an ID exists
You must send a query to YouTube.
and that it is the video that I think it is
How do you define "the video that I think it is"? By ID? By watching the transcoded video at your current resolution -- where the individual pixels might not match the uploaded pixels?

Collecting all or at least a good sample of tweets related to a particular event

I'm interested in using the Tweets in a Complex Networks research project for which I've to collect a good amount of tweets(unbiased sample of tweets) that're related to a particular event, for example, say Boston Bombing. I need to collect the tweets that're related to this event from the event date to current date.
Tried Search API and got to know that I can't retrieve tweets older than a week. I've a small doubt regarding Streaming API, does Streaming API allow you to get older tweets and not real-time tweets. Also, I don't need tweets that're of a particular user.
Is there any way that I can collect the necessary tweets? If there aren't any, can you give me any other archiving sources that I can use?
Thanks a lot.
The streaming API is for accessing what is happening right now, there is no option to "replay" the stream from some arbitrary point in the past. You can access past tweets from individual users' timelines (up to 3,200), but this would require knowing who had tweeted about your event and, as you say, you can only search the past week.
If you are prepared to pay for it, you can get tweets since the start of 2010 via DataSift.
Historical data going back to the very first Tweet ever is only available from Gnip.

youtube direct lite playlists and auto-approval

After struggling with getting Ytd to work for a couple of days I'm about to dive into Youtube Direct Lite which looks much friendlier to set up.
My first question is about the playlist size limit. Once a playlist is full (200 videos?) what would happen with further video submissions? Would the oldest be dropped or is it just impossible to add any more, effectively breaking the widget for that playlist?
I expect I would need to use multiple playlists and manually make new playlists and widgets if there's a lot of videos, but is there a best practice kinda way to do this for a large number of videoslso?
Also, would it be possible to automate the submission approvals programmatically if there's a lot of videos or is this beyond the scope of ytd-lite.
Thought it's better to ask these questions now before starting the process of setting this up for my site. Ytd-lite looks like a great project.
thanks.
from the Doc:
https://developers.google.com/youtube/2.0/developers_guide_protocol_playlists#Adding_a_playlist
Note: Playlists contain a maximum of 200 videos. As such, you will not be able to add a video to a playlist that already contains that many videos.
I dont'n try to force this situation but I expect an error.
I believe that to automate the submission approvals programmatically you can modify the source code of YouTube Direct Lite, and with a little logic in the server side of your app you can do what you want.

Resources