Service Unavailable 503 error, request from Google App Engine app - youtube-api

I have been using YouTube Data API from Google App Engine app for 5 months, without getting Service Unavailable, 503 error response. But today, I got this:
YouTubeError: {
'status': 503,
'body': '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n<html>\n<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title>http://gdata.youtube.com/action/GetUploadToken</title></head>\n<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById(\'captcha\');if(e){e.focus();}">\n<div style="max-width:400px;">\n <hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>\n \n \n <div style="font-size:13px;">\n Our systems have detected unusual traffic from your computer network. Please try your request again later. Why did this happen?<br><br>\n <div id="infoDiv0" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">\n This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the Terms of Service. The block will expire shortly after those requests stop.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests. If you share your network connection, ask your administrator for help — a different computer using the same IP address may be responsible. Learn more<br><br>Sometimes you may see this page if you are using advanced terms that robots are known to use, or sending requests very quickly.\n </div><br>\n \n IP address: 74.125.19.24<br>Time: 2012-10-09T17:48:20Z<br>URL: http://gdata.youtube.com/action/GetUploadToken<br>\n </div>\n</div>\n</body>\n</html>\n',
'reason': 'Service Unavailable'
}
I am using YouTube for uploading videos from users, and also for displaying existing videos (users only input the videos URL).
Does anybody know possible reasons why it isn't working?

I am using gdata python library.
I have yt_service property defined in my video model:
def yt_service(self):
try:
return self._yt_service
except AttributeError:
yt_service = gdata.youtube.service.YouTubeService()
yt_service.developer_key = settings.SYNCR_YT_DEVKEY
yt_service.email = settings.SYNCR_YT_EMAIL
yt_service.password = settings.SYNCR_YT_PASS
yt_service.ProgrammaticLogin()
self._yt_service = yt_service
return yt_service
Then when creating upload form, view call yt_service.GetFormUploadToken to retrieve upload token. It failed in here.

Related

Microsoft Graph API Subscriptions endpoint provides #odata.nextLink that gives a 404

I'm currently experiencing an issue with the subscriptions endpoint.
When making a call to https://graph.microsoft.com/v1.0/subscriptions, a next link is returned.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/subscriptions?$skiptoken=NPt3S7g2KIxJBA0KWwQetRhFtPT2ht6ZVYoisBCCtvlN2050CZg8WeNGnmaMqUn.....",
"value": [
...
...
When following this next link, most of the time, more results and another nextLink should be provided until all the data has been returned.
However for the last two days we have been experiencing issues where following this link has led to the final link giving a 404 response and some html with the following body.
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>404 - File or directory not found.</h2>
<h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>
</fieldset></div>
</div>
</body>
Is this a known issue with the service, or is there a process that should be being followed differently here?
I have been able to replicate this in Postman as well as impacting the java sdk here.
Thank you for your help.
As of 2021-10-13, this issue is no longer occurring and the Graph API is once again functioning as expected.

Connect to bolt server failed

When I try to run the simplest html page that will show me graph of neo4j data, using neovis.js:
<html>
<head>
<title>DataViz</title>
<style type="text/css">
#viz {
width: 900px;
height: 700px;
}
</style>
<script src="https://cdn.neo4jlabs.com/neovis.js/v1.0.0/neovis.js"></script>
</head>
<script>
function draw() {
let config = {
container_id: "viz",
server_url: "bolt://54.210.87.221:32953",
server_user: "neo4j",
server_password: "cents-propeller-slits",
labels: {
"Application": {
caption: "name",
size: "pagerank",
community: "community"
}
},
relationships: {
"DEPENDS_ON":{
caption: false,
thickness: "weight"
}
},
initial_cypher: "MATCH p=(Application)-[r:DEPENDS_ON]->() RETURN p LIMIT 25"
};
let viz = new NeoVis.default(config);
viz.render();
}
</script>
<body onload="draw()">
<div id="viz"></div>
</body>
</html>
I get this error message at the console:
"WebSocket connection failure. Due to security constraints in your web
browser, the reason for the failure is not available to this Neo4j
Driver. Please use your browsers development console to determine the
root cause of the failure. Common reasons include the database being
unavailable, using the wrong connection URL or temporary network
problems. If you have enabled encryption, ensure your browser is
configured to trust the certificate Neo4j is configured to use.
WebSocket readyState is: 3"
I saw the answer in https://neo4j.com/developer/kb/explanation-of-error-websocket-connection-failure/
But I didn't understood where I suppose to do the change, specially when I do not have any Neo4j files or configurations on my computer (Windows).
Why can't I connect to the bolt server like I saw in the guides?
Like the link said, you need to tell Neo4j to listen on the network.
For this you need to change the Neo4j configuration by enabeling the line dbms.connector.bolt.address=0.0.0.0:7687 in the $NEO4J_HOME/conf/neo4j.conf.
So in your case you need to do that on your server 54.210.87.221, not on your local laptop.
Cheers.

NativeScript, WebView show local HTML file if offline

In NativeScript how do I show a local HTML file if the WebView is offline.
In this example I try to load a string instead of a file. But I can't get this to work ether.
let errorHtml = `
<html>
<style>
body {
background-color: red;
color: #fff;
}
</style>
<body>
<h1>Error</h1>
</body>
</html>
`;
webView.on(webViewModule.WebView.loadFinishedEvent, (args) => {
if (!args.error) {
loadLanguagesInWebView();
listenLangWebViewEvents();
} else {
webView.src = errorHtml;
}
});
webView.src = "www.google.com";
If you have included HTML files locally within your app, you don't have to worry whether the device is offline.
If you are asking about loading a remote website when device is offline, then it has nothing to do with the WebView.
It's all you have to do with your web app, implement Service Worker API. I use Angular for my web apps, all I had do was to enable the service worker module to get offline support for my web app. Depending on your web app's tech stack, you might have to do similar adjustments.

Retrieve YouTube live_stats concurrent viewers from channel instead of specific live event video

I know that it is possible to get the number of concurrent viewers for a specific live streaming YouTube event with this link: https://www.youtube.com/live_stats?v={videoid}
I was wondering if is it possible to get the live_stats for a channel or playlist instead of a specific live event.
I want to embed this data in a webpage that will have multiple different live events occurring weekly. Changing the video id for each event will be a burden. If this can't be done directly, is there a way to get the video id of a current live event from a channel and use java script or php to replace the id in the link? Please help me figure this out.
After some time, I figured this out myself...
I created a PHP script that retrieves the video id of the first video in a playlist and puts the id into the live stats link. I take the link of live events and put them into a playlist for easy use.
<?php
// Retrieves video info from Youtube playlist. Just update [PLAYLIST_ID] and [API_KEY]
$json_url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=1&playlistId=[PLAYLIST_ID]&fields=items%2Fsnippet%2FresourceId%2FvideoId&key=[API_KEY]";
$json = file_get_contents($json_url);
$json=str_replace('},
]',"}
]",$json);
$data = json_decode($json, true);
$videoId = $data['items'][0]['snippet']['resourceId']['videoId'];
$viewers = file_get_contents("https://www.youtube.com/live_stats?v=$videoId");
echo $viewers;
?>
I then created an HTML page where the data is dynamically updated using jQuery.
<html>
<body>
<div id="status" style="color: #666; line-height: 24px; font-size: 19px; font-weight: normal; font: 19px Roboto,arial,sans-serif;"></div>
<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
function update() {
$.ajax({
url: 'viewers.php',
dataType: 'text',
success: function(data) {
if (parseInt(data) == 0) {
$("#status").css({ display: "none" });
} else {
$("#status").text(parseInt(data) + ' watching now' );
}
}
})
}
update();
var statusIntervalId = window.setInterval(update, 5000);
</script>
</body>
</html>
This is how far I got. Now I am just wondering if there is a better way to combine these codes together to create less server requests. Each jQuery request happens every 5 seconds and is approximately 240 bytes is size. Even though the requests are small, they might still slow down a page.
If you can, please help me improve my solution. Thank you in advance.

Consume WCF Rest Service in ASP.net using jquery

I am trying to consume a wcf rest api in a asp.net project using jquery. for doing so i have done:
Created a WCF Rest service source code can be downloaded from here.
Created a ASP.Net project to consume that restAPI using jquery. source code here.
In ASP .Net project on the click of button I am trying to call a REST service. But every time I gets two issues:
calling var jsondata = JSON.stringify(request); in TestHTML5.js throws an error saying "Microsoft JScript runtime error: 'JSON' is undefined"
When I press ignore it continues towards WCF Rest API call but it always returns error (Not Found) function. Rest API never gets called.
Thanks for every one's help in advance.
ANSWER:
Solution and source link can be found on this link.
I have looked at the sample code you provided and the problem is that you are violating the same origin policy restriction. You cannot perform cross domain AJAX calls. In your example the service is hosted on http://localhost:35798 and the web application calling it on http://localhost:23590 which is not possible. You will have to host both the service and the calling application in the same ASP.NET project. You seem to have attempted to enable CORS on the client side using ($.support.cors = true;) but on your service doesn't support CORS.
Another issue saw with your calling page (TestHTML5.htm) is the fact that you have included jquery twice (once the minified and once the standard version) and you have included your script (TestHTML5.js) after jquery. You should fix your script references. And yet another issue is the following line <script type="text/javascript"/> which is invalid.
So start by fixing your markup (I have removed all the CSS noise you had in your markup in order to focus on the important parts):
<!DOCTYPE html>
<html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>SignUp Form</title>
<script type="text/javascript" src="../Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../Scripts/TestHTML5.js"></script>
</head>
<body>
<button id="Send" onclick="testHTML5OnClick();">
Send Me ID!
</button>
</body>
</html>
and then in your TestHTML5.js you could also clean a little bit. For example your service is listening for the following url pattern json/{id} and accepting only GET verbs and you are attempting to use POST which is not possible. In addition to that you are attempting to use the JSON.stringify method which doesn't make any sense with the GET verb. You should simply send the id as part of the url portion as you defined in your service.
function testHTML5OnClick() {
var id = 5;
var url = "../RestServiceImpl.svc/json/" + id;
var type = 'GET';
callLoginService(url);
}
function callLoginService(url, type) {
$.ajax({
type: type,
url: url,
success: serviceSucceeded,
error: serviceFailed
});
}
function serviceSucceeded(result) {
alert(JSON.stringify(result));
}
function serviceFailed(result) {
alert('Service call failed: ' + result.status + '' + result.statusText);
}
Did u add this reference?
script type="text/javascript" src="../../json.js"></script>
I have same problem and search i get this and this result

Resources