Uploading video using Google Drive API

Hello
I am using the Google Drive API and my personal token to create a direct URL for my mp4 video file on a shared Google Drive. The file is shared with “anyone with the URL” and I use Google Drive API to turn the document ID into a direct URL. If I click the link, the browser will open the save-as dialogue and allow me to download the file (I have tried with an incognito browser and with Postman and both ways it works).

Now, when I use the Cloudflare “Upload via link” API to copy the file to my Cloudflare Stream account, using the very same URL, the file placeholder is created and it says “Downloading”. After a short while, the status turns into “Failed” and the file JSON says:

...,
"status": {
      "state": "error",
      "step": "fetching",
      "errorReasonCode": "ERR_FETCH_ORIGIN_ERROR",
      "errorReasonText": "There was an unknown error while downloading the video from the source."
    },
    "meta": {
      "downloaded-from": "https://www.googleapis.com/drive/v3/files/[THE_FILE_ID]?alt=media&key=[MY_API_KEY]",
      "name": "Test file upload"
    },

I have tried many different querystring params to the Google URL, but though most works for the browser and postman downloads, none work with the Cloudflare API.
I was hoping for some better error messages, since I cannot come up with more ways to investigate.
Any chance one of you knows?

Thanks, Simon

Does the link you get from Google Drive redirect or is it a ‘hard’ link to a video file? Maybe Cloudflare isn’t able to follow redirects.

Thank Raymon

It appears to be a “hard link”. Here is the response I get when I request the Google URL with Postman (and the file starts downloading as expected):

It looks like an error on the Cloudflare Stream API to me and therefore not anything that the community can do anything about. I have clicked around the “Cloudflare Help Center” without being able to land in place, where I can actually open a Support Ticket.

So if someone could show how to get the attention of Cloudflare Tech Support I will gladly post the solution here (I have seen this issue raised several places without landing on a solid solution for video uploads from Google Drive).

Can you share an example link? My email is zaid at cloudflare.com

Thanks @zaid, I have emailed a link for you

An update about this. We have not yet managed to get a stable upload from the Google Drive API to Cloudflare Stream. I works approximately 1 out of 5 times :frowning:

My solution ended up being this:

  1. Create a Google cloud storage bucket
  2. Use a Google Collab notebook to copy folders of files from my Google Drive to Google Cloud Storage bucket
  3. Make bucket publicly available to people with the link
  4. Use that link to upload to Cloudflare

…Man that’s overly complex, but it works for now.
Still hoping to see some improved import methods for Cloudflare Stream, I suppose it’s a pretty valid onboarding feature to allow customers to easily transfer their videos to Cloudflare.

br, Simon