Unable to download video from Google Photos API baseUrl - google-photos-api

I am trying to download a video from {baseUrl=dv}. ( URL 1 )
After that the page on this URL was redirected and getting a 500 error ( URL 2 ).
What's missing?

There is currently a known issue with base URLs for videos. Accessing the video via the dv parameter returns a 500 Error.
You can follow along on the issue tracker here: https://issuetracker.google.com/111638708 ("Star" the issue to be notified of any updates.)

Related

Publishing Custom Vision Azure in Website

I made a image classification using custom vision and published it. After that I got this publishing url and prediction key. Now I am literally confused how to use this as a api in a website that I am making using MERN.
Also the prediction url doesnt work- "{"error":{"code":"404","message": "Resource not found"}}"
This is the ouput details after publishing:
If you have an image URL:
https://assam-prediction.cognitiveservices.azure.com/customvision/v3.0/Prediction/**2/classify/iterations/TradiitionalVsWestern/url
Set Prediction-Key Header to : ***
Set Content-Type Header to : application/json
Set Body to : {"Url": "https://example.com/image.png"}
I reproduced the same thing in my environment. When you are request via GET method you will get a 404 error for predication. You can use prediction call by using the POST method as per MS document
To resolve the above use POST method and follow the steps.
You can use both image and Image URL.
Syntax of my prediction URL
https://democustv-prediction.cognitiveservices.azure.com/customvision/v3.0/Prediction/ecsxx /classify/iterations/Iteration1/image
Select your image down here
Now everting is working fine 200 OK.

Can we upload media files using URL in MediaFileUpload?

Basically all I want to know is, I am working on Youtube API to upload videos on my channel. Whenever I try to upload video from my local file, it works without any issue. But if I want to upload some videos which are already hosted on S3, it gives me error related to OS i.e. OSError: File not found at that location.
So is there any way to upload video using youtube API from already hosted URLs ?
P.S. I am following the documentation of youtube API and using MediaFileUpload to upload the video files.
Edit 1: I tried a minor hack around this particular issue and works fine for me. Just leaving it here for future developers.
import requests
from six import BytesIO
url = "" # The video url you want to upload (I use S3 urls, not sure if it will work with youtube urls)
res = requests.get(url)
file = BytesIO(res.content)
media = MediaIoBaseUpload(file, mimetype="application/octet-stream")

Adding image from google drive into google slideshow with API

I'm trying to add an image that I've uploaded to Drive via the Drive API into a slide show I've created using the same API.
when Running the fairly standard:
response = (self
._slides_service
.presentations()
.batchUpdate(presentationId=slide_deck_id, body=body)
.execute()
)
I get:
googleapiclient.errors.HttpError: <HttpError 400 when requesting {url} returned "Invalid requests[0].createImage: The provided image is in an unsupported format.">
I'm generating the service in the same way as suggested in the documentation here: https://developers.google.com/slides/quickstart/python
My scope is:
https://www.googleapis.com/auth/presentations
If I run the command with a random png from the internet then it inserts the image fine. I've tried the url provided by webContentLink or WebViewLink values from the response from uploading the images. Neither are valid.
What URL will work to do this?
I'm aware there are other similar questions on stack overflow but all of them are not related to doing this in python or if they are, there solutions don't work.
EDIT:
body is:
{'requests': [{'createImage': {'url': url, 'elementProperties': {'pageObjectId': page_id}}}]}
had to generalise the url and page id because GDPR is a pain.

HTTP Error 405.0 - Method Not Allowed while Form Post

I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get "HTTP Error 405.0 - Method Not Allowed".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below
Request Path : *
Module : StaticFileModule
Name : staticFile
Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders
My question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.
Thanks in advance if more input is needed from my side kindly ask in reply.
It's not that HTML does not allow POST by default, it's that HTML does not handle POST, period. (Not even if the HTML file contains JavaScript.) POST sends data to a script that runs on your server, and the script has to be smart enough to know what to do with the data. HTML isn't that smart. The only thing your server can do with HTML is to send the HTML back to whatever is requesting it. You need a server-side script that knows how to parse payu's response, do something appropriate with the hash, and then generate some HTML to display in the user's browser.

Scraping youtube mix playlist id for a video

So here is what I am trying to do:
The app in question that this problem is regarding is here: https://github.com/viperfx/ng-juketube, to give everyone some context. So I am loading a youtube video in the background using the youtube Iframe API giving it a youtube video id. That works well. Next, I want to find out the playlist ID of the youtube mix's that appear sometimes on the sidebar.
Current solution:
I am using nodejs in the backend to scrape the youtube video page, and then look in the sidebar for the string 'Youtube Mix'. When I am running my server locally this works well. However when I am running the app from heroku I do not get the same results (as in a mix does not show up) because I am assuming the youtube server and the IP address I have are affecting youtube mix from showing up.
So my question is how can I obtain the youtube mix playlist id using the client (browser) rather than the server?
I have tried things like trying to load the youtube page as an iframe - does not work. iframes only allowed for /embed*
So here is how I solved this issue.
Using a service called http://www.corsproxy.com/ I was able to scrape youtube and get the playlist id using client side code. Here is a snippet from my code showing the solution:
$.get('http://www.corsproxy.com/www.youtube.com/watch?v='+newVal.videoId,function(response) {
var doc = new DOMParser().parseFromString(response, 'text/html');
$scope.mixId = doc.querySelector('.related-playlist').getAttribute('href').split('list=')[1];
$scope.$apply();
});

Resources