Google 414 Error with Youtube API requests - youtube-api

my company has been developing a TV Guide web app for Youtube for the past 3 months and we launched our beta yesterday, http://martelltv.com/
It works fairly well as intended, but with one problem: we're getting a Google 414 error under certain circumstances.
To create the effect of broadcast television using Youtube, the episode containers “play back to back” feature currently works with a playlist that is consumed in the Youtube servers. We store the YT video ids and when someone ask to watch an episode we send the ids to the YT API and YT get back to us with the videos. However, we've noticed that if we schedule more than (I think the number was?) 50 videos to play in a 'day', we get a Google 414 error.
We believe the 414 error is mostly happening because of the YT restrictions, and would like to know if that restriction could be increased for our app so a full 24 hour worth of videos could be scheduled in a Station for playing?

An HTTP 414 response indicates that the request URI is too long. I don't know how you're constructing the URIs that you're sending to the YouTube API (whether you're using a client library, constructing them manually, etc.), but I'd recommend you take a specific look at the full URI that you're requesting when you get back a 414 response and see if there's any "junk" or extraneous characters that you're adding to it that would cause it to trigger that error.

Related

How to increase video upload quota on Youtube API?

We are a UA agency and we are building an internal tool to automatically upload videos on YouTube in order to then use these videos in our Google Ads App Campaigns. However, we are currently limited to uploading 6 videos through YouTube API per day which is way too low compared to our needs. We followed the process to request a quota increase. However, we can't go through as our system is internal so Google can't check its use or purpose. We would like to get in touch with someone to whom we can explain the issue.
Cheers,
Matthieu
By default, YouTube allows video uploads that are up to 15 minutes long. If you try to upload videos longer than 15 minutes, the upload will fail. This is a YouTube limitation rather than a Brightcove limitation.
To upload longer videos to YouTube, you need to verify your account with YouTube:
Open the YouTube upload page at https://www.youtube.com/upload.
Click Increase your limit link at the bottom of the page.
Note: If you can't find the Increase your limit link, it's possible that you may already be able to upload long videos. Check the Longer videos section in your YouTube Account Features page to check if the feature has already been enabled.
Follow the steps to verify your account with a mobile phone.
When you receive a text message from YouTube in response, enter the verification code from the text message and click Submit.
YouTube will then confirm when your YouTube account has been activated for longer uploads. From this point, any videos longer than 15 minutes in your Video Cloud account will be synced to YouTube.
You'll need to apply for a quota extension, you can do so here: https://support.google.com/youtube/contact/yt_api_form?hl=en

YouTube DataApi v3 subscription limitations

I am using https://developers.google.com/youtube/v3/guides/push_notifications to continually monitor ~ 2,000 channels for new videos etc.
Up until last week, I wasn't having any problems, with pubnubsubbub, however, for some reason, I am getting 403 when I am trying to access (via curl or requests) https://pubsubhubbub.appspot.com/subscribe saying nothing more than
<p>
<b>403.</b> <ins>That’s an error.</ins>
<p>Your client does not have permission to get URL <code>/subscribe</code> from this server. <ins>That’s all we know.</ins>
</p>
So my questions are:
is there any limit (either IP or time or quota) that is documented somewhere and I am somehow hitting? As xml calls were "unlimited" and i do not see any difference in the official YouTube Data Api documentation
have somebody found a better pub/sub channel (either paid or not) with YouTube DataApi 3
if somebody had a similar situation, how long my "ban" will stay
As suggested by Marco Aurelio, I am adding my solution.
My VPS provider had some bans from Google on their IPv6 network in the data center where I had my server running. Thus by contacting them and fixing my network settings the pubsubhubbub continued working without issues.
So the tip for future debuggers stumbling upon here is trying to curl any other Google API (e.g. a function) that you are 100% sure it works and if you are still getting 403, then your IP address range is blocked for some reason (like data center ban in my case).
If you continue to have the problem and getting the "notification" with a maximum delay of 6 minutes isn't a problem, here is a workaround.
I don't use pubsubhubbub but you can simulate its advantages. Indeed you have 10 000 quota a day, using PlaylistItems: list with the uploads playlist of the channel found with contentDetails in part by using Channels: list.
In that way you can check for new videos for 50 YouTube channels for 1 quota so if you want to check your 2 000 channels you have to spend 40 of quota.
If you want to uniformly check during the day you can so make 250 global checks a day, so every 346 seconds (almost 6 minutes).
Of course you have to store your last videos found for a YouTube channel in order to check if there is any difference during your new global check.
If you just want a boolean response whether or not your current request response is different from the previous one, you can check the etag.

Youtube API - Difference between number of videos from channel statistics and number of videos uploaded

I am trying youtube API to get the number of videos using the call
https://www.googleapis.com/youtube/v3/channels?part=statistics&id=[id]&key=[key]
However, there is a mismatch in the number of uploaded videos. There are 178 videos uploaded in the channel and the channel statistics API is showing 177.
Why is the difference of 1 count?
UPDATE
After 3 days, I got the correct count from channel statistics API.
Still, the question is "Is there a chance to get the difference?"
If that is the case, I would prefer to use the number of videos uploaded instead of the channel statistics.
Watch time report shows the following data collected from youtube.com, the video watch page, mobile Youtube apps (some data is only available from youtube.com).
Note: Analytics views data is based in Pacific Standard Time, updated once a day, and has a delay of up to 72 hours. The numbers you
see in Analytics reports might be different from the numbers you see
on the video page, channel page, Video Manager, or other sources.
Then I suggest that you use the number of videos uploaded.

How can I get the status of a user's stream?

I'm building a thing that tells people when a YouTube stream goes live. In order to build this, I need to know when a stream goes live, be it via push notification, polling, or some other method.
With Twitch, it's dead easy. All you have to do is send a GET to https://api.twitch.tv/kraken/streams/[STREAMER_USERNAME_HERE] and you get a JSON object with everything you'd ever hope to know (try it in your browser, it's great). I have combed through the YouTube Streaming and Data API's and nothing even close to this feature seems to exist.
I know that something, somewhere is alerting something when a stream goes live, because my phone gets a notification when the people I am subscribed to start streaming. But if there are no public calls in the API, I'm left with no other option than scraping the HTML off a page every couple seconds, which is bad for both me and YouTube.
Further on this, YouTube's push notification API for regular videos famously doesn't work [1] [2] [3] [4], and every dev is left to either use the deprecated XML feeds (which update sometimes up to an hour slow) or scrape HTML off youtube.com pages (the only current solution for instant updates). So, even if there's something off the API that I missed, it's moot if it doesn't actually work.
That said, am I missing something? Is it possible to get a notification if a stream goes live? It's kind of a deal-breaker for YouTube vs Twitch if there isn't.
It is currently not possible to do what you are asking with the public YouTube API.
You can only retrieve information about your own liveStream or liveBroadcast objects, not anyone else's. Additionally, there is no public API to get a notification when another user goes live.

Expected delay for youtube feeds?

We switched over to YouTube from a previously developed internal video system, and right now I've got it going on public upload feeds for users. The problem comes when we first got only about a dozen out of 150 or so videos available from the primary user's account. Over time of the day that number rose to about 50, and its stayed there. I found one post on the YouTube API forums about delay, but no word on how long I can expect that.
Anyone have experience about this to tell me what to expect?
Expected latencies can vary, and are documented here (http://code.google.com/apis/youtube/2.0/reference.html) - ways you can minimize it:
1) Upload the video as public. If you upload the video as private first, this will leave the video out of the fast-track indexing
2) Make an authenticated request to the user feed, this will guarantee the freshest data that the API has.
ie. http://gdata.youtube.com/api/feeds/users/username/uploads (with a dev key and auth token for 'username') instead of http://gdata.youtube.com/api/feeds/videos?author=username

Resources