Youtube API - limit without developer key - youtube-api

For a client of ours, we use the Youtube API v2 to fetch the newest video with a specific tag. We fetched the response of the URL without a developer key. Up until a few days ago, this worked perfectly. Suddenly, we got no results back. Instead of getting an error, we just got 0 results.
After a bit of puzzling, we found out that this is because we probably went over a limit of requests. This is a conclusion based on the fact that when we went to the same URL with a mobile device on 3G as a laptop connected with WiFi, we got results.
My question is this:
Is it possible to get an error in our request if we went over a limit?
What exactly is the limit when not using a developer key?
Is there a premium account available to fetch a much bigger amount of requests?
Thanks in advance!
[EDIT]
When we request the URL https://gdata.youtube.com/feeds/api/users/AEGON/uploads?category=2012Q4&alt=json, we get the following response in JSON:
(I removed some links because of reputation on Stack Overflow)
{
"version": "1.0",
"encoding": "UTF-8",
"feed": {
"xmlns": "",
"xmlns$openSearch": "",
"id": {
"$t": ""
},
"updated": {
"$t": "2013-03-12T08:35:47.226Z"
},
"category": [{
"scheme": "",
"term": ""
}],
"title": {
"$t": "Uploads by AEGON",
"type": "text"
},
"logo": {
"$t": ""
},
"link": [{
"rel": "related",
"type": "application/atom+xml",
"href": ""
},
{
"rel": "alternate",
"type": "text/html",
"href": ""
},
{
"rel": "",
"type": "application/atom+xml",
"href": ""
},
{
"rel": "",
"type": "application/atom+xml",
"href": ""
},
{
"rel": "self",
"type": "application/atom+xml",
"href": "https://gdata.youtube.com/feeds/api/users/AEGON /uploads?alt=json&start-index=1&max-results=25&category=%7Bhttp://gdata.youtube.com/schemas/2007/keywords.cat%7D2012Q4"
}],
"author": [{
"name": {
"$t": "AEGON"
},
"uri": {
"$t": ""
}
}],
"generator": {
"$t": "YouTube data API",
"version": "2.1",
"uri": ""
},
"openSearch$totalResults": {
"$t": 0
},
"openSearch$startIndex": {
"$t": 1
},
"openSearch$itemsPerPage": {
"$t": 25
}
}
}

Answer for your questions,
you'll receive an HTTP response with a code of 403 and a response
body that includes
[<errors><error><domain>yt:quota</domain><code>too_many_recent_calls</code></error></errors>]
for excessive request.
There is no such limit, you need to stop the request for 10 to 15 min. after receiving error.
No idea for this.
Reference: http://apiblog.youtube.com/2010/02/best-practices-for-avoiding-quota.html

According to youtube documentation, you will receive an error message letting you know that you exceeded the quota.
Check Operation limits

Related

Pull Request Statuses - Added custom properties to a status aren't getting persisted by TFS

We are operating a TFS 2018 Update 2 in our enviroment.
We are sending the example json found here to our server and it is getting accepted successfully:
{
"properties": {
"sampleId": 7,
"customInfo": "Custom status information",
"startedDateTime": {
"$type": "System.DateTime",
"$value": "2017-09-19T14:50:26.7410146Z"
},
"weight": {
"$type": "System.Double",
"$value": 1.75
},
"bytes": {
"$type": "System.Byte[]",
"$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
},
"globalId": {
"$type": "System.Guid",
"$value": "1e788cb9-9d3d-4dc6-ac05-822092d17f90"
}
},
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}
But the response doesn't look like in the documentation. Instead it looks like this:
{
"id": 6,
"state": "succeeded",
"description": "Sample status succeeded",
"context": {
"name": "sample-status-1",
"genre": "vsts-samples"
},
"creationDate": "2019-12-11T16:14:05.0574648Z",
"updatedDate": "2019-12-11T16:14:05.0574648Z",
"createdBy": {
"displayName": "...",
"url": "https://.../_apis/Identities/0b85e078-130d-4cb8-a450-17c5c7efccec",
"_links": {
"avatar": {
"href": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
}
},
"id": "0b85e078-130d-4cb8-a450-17c5c7efccec",
"uniqueName": "...",
"imageUrl": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
},
"targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1",
"_links": {
"self": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d/pullRequests/58/statuses/6"
},
"repository": {
"href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d"
}
}
}
The properties are gone. What could be wrong?
Could it be a somehow completely missleading documentation?
To troubleshoot your issue, please check the following items:
Check whether the Status updated on the pull request after running the POST request.
Press F12 in your browser, and send the POST request to check the statuses to see whether you can get properties in the response body.
Check your TFS edition by going to Administration Console -- Application Tier, or checking the About on the web portal. The issue can not be reproduced in TFS 2018.2 on our side.

Graph Pagination in Logic Apps

I'm trying to fetch all users from a specific group via an HTTP connector, a registered app, and Microsoft Graph.
The registered app has Directory.Read.All permissions.
My idea is that I'm calling the nextLink as long as it's there while appending all of the fetched users' userPrincipalName to an array eventually filling the array with all users of the group.
My Logic App looks like this:
Unfortunately, I'm just 1 reputation short of posting images, please forgive. The 3 links should provide an overview of the structure of my app.
First, nextLink is initialized to the first Graph API endpoint. This variable is set to the current nextLink through each iteration of the until loop.
Second, For the purpose of this exercise, I only get the top 5. I know there are only 9 users:
Lastly, I call the union method on the "users" array that I initialized earlier and the "value" array from the HTTP get method, to get one single array consisting of all users:
The issue is that the HTTP action always returns the same top 5 users. I've checked that the nextLink provided in the first HTTP GET call to Graph, is correct by copying it from the Runs history and pasting it into Microsoft Graph Explorer and there the next 4 users are correctly returned.
I also made sure that, for each iteration in the until loop, I call the Graph API with the nextLink from the previous iteration as expected.
The nextLink returned inside of the Logic App is exactly the same when I test it in Graph Explorer, but the same nextLink returns 2 different results when called from Graph Explorer and inside my Logic App.
Why is the result always the same top 5 users and not the next 4 users as expected?
If not sure about the reason why you will get this issue, but based on your requirement, I did a sample below:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "GetGroupUrl",
"type": "string",
"value": "https://graph.microsoft.com/v1.0/groups/<your group id>/members?$select=userPrincipalName&$top=5"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Initialize_variable_2": {
"inputs": {
"variables": [
{
"name": "users",
"type": "array"
}
]
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Until": {
"actions": {
"Compose": {
"inputs": "#union(variables('users'),body('HTTP')['value'])",
"runAfter": {
"HTTP": [
"Succeeded"
]
},
"type": "Compose"
},
"HTTP": {
"inputs": {
"authentication": {
"audience": "https://graph.microsoft.com",
"clientId": "<app id>",
"secret": "<app secret>",
"tenant": "<your secret>",
"type": "ActiveDirectoryOAuth"
},
"method": "GET",
"uri": "#variables('GetGroupUrl')"
},
"runAfter": {},
"type": "Http"
},
"Set_variable": {
"inputs": {
"name": "GetGroupUrl",
"value": "#{if(equals(body('HTTP')?['#odata.nextLink'], null),null,body('HTTP')['#odata.nextLink'])}"
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "SetVariable"
}
},
"expression": "#equals(variables('GetGroupUrl'), '')",
"limit": {
"count": 60,
"timeout": "PT1H"
},
"runAfter": {
"Initialize_variable_2": [
"Succeeded"
]
},
"type": "Until"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"method": "GET",
"schema": {
"properties": {
"text": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
You can just replace the params with your own and paste it into your logic app code view and test it .
It works for me, as you can see , each request results are different :
Hope it helps .
This issue solved by OP self, this issue is due to queries in request URL , copy OP's comment as an answer :
After fiddling a bit more around with what each of you providing I
found a solution. It seems that when the query arguments are passed to
the HTTP GET outside of the endpoint itself (meaning in the "queries"
field inside of the block) it seems to keep overriding the nextLink.
When writing the endpoint URL out entirely with the odata parameters,
it works as intended.

How fetch "webParts" from site pages

I am trying to fetch Pages from Sharepoint sites using graph API.
But when we make GET request with
https://graph.microsoft.com/beta/sites/{site-id}/pages/{page-id}
the response consists of webParts which only have type and data.
Inside data we have an id(which same as type) and an instanceId that is unique for every webPart.
Sample webPart:
{
"type": "d1d91016-032f-456d-98a4-721247c305e8",
"data": {
"id": "d1d91016-032f-456d-98a4-721247c305e8",
"instanceId": "c54a74ef-86c1-44aa-9ba4-802e6841e3a7"
}
My goal is to fetch webPages with complete details and then backup them to a local drive in any format.
The documentation of graph API shows that the responce would consist of complete details for the webPart, but it is not so.
Documentation link: https://learn.microsoft.com/en-us/graph/api/sitepage-get?view=graph-rest-beta&tabs=http
Sample request URL:
https://graph.microsoft.com/beta/sites/m365x214355.sharepoint.com,c1e5444e-12d8-43d3-96b1-f2f66559ef58,b181bdf0-9680-4988-81f7-a24aee4afd6a/pages
Webpart repsonse:
"webParts": [
{
"type": "rte",
"data": {
"innerHTML": "<p>Take a look at the team behind delivering amazing fashion events for Contoso.</p><p>Find out how the team uses the latest technology to plan amazing fashion shows and gather customer feedback for future events.</p><p>Meet the people behind Contoso's events, learn how to plan your own event, and find the necessary resources to run highly successful fashion shows, premiers, and extravaganzas!</p>"
}
},
{
"type": "d1d91016-032f-456d-98a4-721247c305e8",
"data": {
"id": "d1d91016-032f-456d-98a4-721247c305e8",
"instanceId": "c54a74ef-86c1-44aa-9ba4-802e6841e3a7"
}
},
{
"type": "b7dd04e1-19ce-4b24-9132-b60a1c2b910d",
"data": {
"id": "b7dd04e1-19ce-4b24-9132-b60a1c2b910d",
"instanceId": "75ccfeba-ad6c-416d-a859-4a6b114e156e"
}
},
{
"type": "b7dd04e1-19ce-4b24-9132-b60a1c2b910d",
"data": {
"id": "b7dd04e1-19ce-4b24-9132-b60a1c2b910d",
"instanceId": "f04e02fb-45e6-4e74-9f46-0c8d90e7fb8d"
}
},
{
"type": "275c0095-a77e-4f6d-a2a0-6a7626911518",
"data": {
"id": "275c0095-a77e-4f6d-a2a0-6a7626911518",
"instanceId": "c1a222b0-624e-4e30-b544-d2a67e8e1112"
}
}
Expected Response format:
"webParts": [
{
"type": "rte",
"data": {
"innerHTML": "<p>Here are the team's upcoming events:</p>"
}
},
{
"type": "d1d91016-032f-456d-98a4-721247c305e8",
"data": {
"title": "Events",
"description": "Display upcoming events",
"serverProcessedContent": {
"htmlStrings": {},
"searchablePlainTexts": {
"title": ""
},
"imageSources": {},
"links": {
"baseUrl": "https://www.contoso.com/sites/Engineering"
},
"componentDependencies": {
"layoutComponentId": "8ac0c53c-e8d0-4e3e-87d0-7449eb0d4027"
}
},
"dataVersion": "1.0",
"properties": {
"selectedListId": "032e08ab-89b0-4d8f-bc10-73094233615c",
"selectedCategory": "",
"dateRangeOption": 0,
"startDate": "",
"endDate": "",
"isOnSeeAllPage": false,
"layoutId": "FilmStrip",
"dataProviderId": "Event",
"webId": "0764c419-1ecc-4126-ba32-0c25ae0fffe8",
"siteId": "6b4ffc7a-cfc2-4a76-903a-1cc3686dee23"
}
}
}
]
I want webParts in the format as per documentation.
If the instanceId is unique then there might be some reference table to match these instanceIds and fetch the detailed webParts structure.

YouTube API chromeless player token expiration

Summary
I have a Youtube API chromeless player in my Flex/AS3 application. Sometimes I need the player to play movies from Youtube continuously (non-stop).
Issues
After playing for something like 12 or more hours the API token which was generated by the first player initialization request is getting expired.
http://www.youtube.com/apiplayer?version=3&modestbranding=1&autoplay=0
And the issue here is that the API call loadVideoById which is called again after the token is expired can't start playing video, because the token is not getting renewed automatically.
After playing our playlist (each item is getting played by calling to loadVideoById) for something like 4-5 or more hours the video sometimes starts to play and suddenly getting stuck. While no error event is dispatched.
Known Solutions
So for the first issue the solution is to renew the token each 12 hours by unloading the player and loading it again using the API call:
http://www.youtube.com/apiplayer?version=3&modestbranding=1&autoplay=0
For the second issue there are no ideas. Need your help.
The relevant source code
private function CreateYoutubePlayerSWF():void {
...
theYoutubeLoader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
theYoutubeLoader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3&modestbranding=1&autoplay=0"));
...
}
private function PlayPendingVideo():void {
...
theYoutubePlayer.loadVideoById(videoWaitingToPlayInfo.videoWaitingToPlay);
...
}
Requests & Responses
When the player stops playing this is what I get in the fiddler:
"request": {
"method": "GET",
"url": "http://www.youtube.com/get_video?cpn=Lj5HaLu7MzS5kG-T&fmt=35&splay=1&t=vjVQa1PpcFNwMVrYUDFOTTG-7co1uJFo3oyrB-qoP_k=&video_id=j-vJJSqw5Q4&eurl=http%3A%2F%2Fwatchitoo.com%2Fiframe.php%3Fid%3Dwwa-154%26scale%3Dfalse%26layout%3D14&asv=3&el=embedded&ps=chromeless&ptk=youtube_none&noflv=1",
...
"queryString": [
{
"name": "cpn",
"value": "Lj5HaLu7MzS5kG-T"
},
{
"name": "fmt",
"value": "35"
},
{
"name": "splay",
"value": "1"
},
{
"name": "t",
"value": "vjVQa1PpcFNwMVrYUDFOTTG-7co1uJFo3oyrB-qoP_k"
},
{
"name": "video_id",
"value": "j-vJJSqw5Q4"
},
{
"name": "eurl",
"value": "http%3A%2F%2Fwatchitoo.com%2Fiframe.php%3Fid%3Dwwa-154%26scale%3Dfalse%26layout%3D14"
},
{
"name": "asv",
"value": "3"
},
{
"name": "el",
"value": "embedded"
},
{
"name": "ps",
"value": "chromeless"
},
{
"name": "ptk",
"value": "youtube_none"
},
{
"name": "noflv",
"value": "1"
}
"response": {
"status": 410,
"statusText": "Gone",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Wed, 26 Jun 2013 16:32:37 GMT"
},
{
"name": "X-Content-Type-Options",
"value": "nosniff"
},
{
"name": "Server",
"value": "Apache"
},
{
"name": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"name": "Content-Type",
"value": "video/x-flv"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Content-Length",
"value": "0"
},
{
"name": "Expires",
"value": "Tue, 27 Apr 1971 19:44:06 EST"
}

Facebook FQL: Difference between status table and stream table?

Can anyone tell me what the difference is between the status table and the stream table?
I am querying my own posts using the graph explorer and I find some status updates appear only in the status table, and others appear in both the stream and status table. When I go to my own Timeline I can see posts from both tables.
What is going on here? Why are some in the posts table only, but appear on my Timeline?!
I am trying to find a list of all my posts that are publicly visible, and it seems to do this I need to query both tables and end up with some duplicates. Is there a better way?
Here is an example:
graph.facebook.com/10150680671412355
{
"id": "10150680671412355",
"from": {
"name": "Alan Byrne",
"id": "509517354"
},
"message": "Beans on toast.",
"updated_time": "2012-03-14T10:53:01+0000",
"likes": {
"data": [
{
"id": "xxxxx",
"name": "xxxx"
}
],
"paging": {
"next": "https://graph.facebook.com/10150680671412355/likes?method=GET&metadata=true&format=json&callback=___GraphExplorerAsyncCallback___&access_token=AAACEdEose0cBAPjaO9gCyMZA2TT5hRE7iEkgmksfpNneFdtshFDfp0oM3hiX6I57vUkzGZAyXW5c9YaM1WQFUxt2zTZCden7zTAlbMSDAZDZD&limit=25&offset=25&__after_id=100001368900242"
}
},
"comments": {
"data": [
{
"id": "10150680671412355_31516486",
"from": {
"name": "xxxxx",
"id": "xxxxx"
},
"message": "Peasant. Baked beans on the other hand...",
"can_remove": true,
"created_time": "2012-03-14T11:20:35+0000"
}
],
"paging": {
"next": "https://graph.facebook.com/10150680671412355/comments?method=GET&metadata=true&format=json&callback=___GraphExplorerAsyncCallback___&access_token=AAACEdEose0cBAPjaO9gCyMZA2TT5hRE7iEkgmksfpNneFdtshFDfp0oM3hiX6I57vUkzGZAyXW5c9YaM1WQFUxt2zTZCden7zTAlbMSDAZDZD&limit=25&offset=25&__after_id=10150680671412355_31516486"
}
},
"type": "status"
}
Yet, when I scan for posts on the stream on that same day, this one does not come back
fql?q=select message,post_id,created_time from stream where source_id=509517354 and created_time > 1331596800 and created_time < 1331856000
{
"data": [
{
"message": "",
"post_id": "509517354_10150680640782355",
"created_time": 1331720877
},
{
"message": "",
"post_id": "509517354_10150680632467355",
"created_time": 1331720499
},
{
"message": "MY COMPUTER DOES NOT HAVE VIRUSES! STOP CALLING ME! ARGH!",
"post_id": "509517354_10150680618357355",
"created_time": 1331719866
},
{
"message": "",
"post_id": "509517354_10150680602327355",
"created_time": 1331719906
},
{
"message": "I did it!",
"post_id": "509517354_10150680491832355",
"created_time": 1331716355
},
{
"message": "",
"post_id": "509517354_10150680446052355",
"created_time": 1331714440
},
{
"message": "It got to Australia.\n",
"post_id": "509517354_365689393454249",
"created_time": 1331679835
},
{
"message": "",
"post_id": "509517354_107999992664739",
"created_time": 1331677643
},
{
"message": "",
"post_id": "509517354_10150678888762355",
"created_time": 1331671872
},
{
"message": "Booooo",
"post_id": "509517354_268316116580687",
"created_time": 1331632096
},
{
"message": "'spose I should wander into the office...",
"post_id": "509517354_10150678259167355",
"created_time": 1331625013
},
{
"message": "",
"post_id": "509517354_10150678258862355",
"created_time": 1331624991
},
{
"message": "",
"post_id": "509517354_10150678257547355",
"created_time": 1331624907
},
{
"message": "",
"post_id": "509517354_10150678250602355",
"created_time": 1331631742
}
]
}
The stream contains posts of various types - links, checkins, photos and status updates.
The status table only contains status updates - text with no additional links, photos etc.
If you're hoping to find the content similar to the timeline, you'll want to use the stream table.

Resources