Disabling the large file notification from google drive - download

While downloading zip file(more than 25MB i assume) i am getting the below notification,
Sorry, we are unable to scan this file for viruses.
The file exceeds the maximum size that we scan. Download anyway
in the browser.Is there any option to disable it,so that i can download any large file directly without having to receive such messages as interruption.
Want to know whether any setting is there in the google drive, so that i can disable that broker message.

After spending many countless hours trying to get a direct download link that bypasses the virus scan I finally figured it out by accident. A URL in the format below along with your Google API key will bypass the virus scan. I could not find this documented anywhere (here is the official doc) so use at your own risk as future updates might break it. https://www.googleapis.com/drive/v3/files/fileid/?key=yourapikey&alt=media
You can also use the authorization access token from google oauth instead of the apikey.

Obsolete: this approach no longer works after August 31, 2016
I found that the following pattern allows to disable the large file notification:
https://googledrive.com/host/file-id
I think anyone knows how to find the file-id for Google Drive file.
Please keep in mind that this method works only if file is shared with "Public on the web" option.
But this feature is deprecated and will stop working after August 31, 2016: http://googleappsdeveloper.blogspot.com/2015/08/deprecating-web-hosting-support-in.html

I don't believe there is any longer a way to bypass Google Drive's warning that a file is too big to be scanned for viruses.
At one time Google Drive had web hosting support via webViewLink URLs that look like googledrive.com/host/[doc id]. But that feature is deprecated and will stop working after August 31, 2016.
http://googleappsdeveloper.blogspot.com/2015/08/deprecating-web-hosting-support-in.html
https://developers.google.com/drive/v2/web/publish-site

use zip-extractor to download file and extract to your Google Drive. It's offered as an option at the website you found the link at. You have to be logged in at Google Drive for this to work.

A better alternative is to use a Google Cloud Bucket.
Open the Cloud Storage browser in the Google Cloud Platform Console.
Create bucket that is Multi-Regional or Regional based on your need.
Upload the file o the bucket and make it public.
Use the public url to download the file using scripts, browser, gcloud commands, wget or curl.
This will work for any file size. Cloud Bucket service is really cheap. Google gives you free credits to start out and the bucket use can be well covered under the free credits.

WGET
export fileid=<file-id>
export filename=combian.rar
wget --save-cookies cookies.txt 'https://docs.google.com/uc?export=download&id='$fileid -O- \
| sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' > confirm.txt
wget --load-cookies cookies.txt -O $filename \
'https://docs.google.com/uc?export=download&id='$fileid'&confirm='$(<confirm.txt)

You can bypass preview, virus scan, AND get the correct file name if you simply use the following link convention:
https://drive.google.com/uc?export=download&confirm=yTib&id=FILE_ID
where the google drive file id replaces FILE_ID.
Thanks,
Mick

Well you can try "Download anyway"
If that doesn't work I have found with Gmail that by changing the extension to .txt it allows the file to be downloaded/transferred then when downloaded you can change it back to .zip

The way to go is to use the link format Mick suggested:
https://drive.google.com/uc?export=download&confirm=CONFIRM_CODE&id=FILE_ID
The confirm Code ist valid indefinitely for each file. It does not change over time. So far the only way to find out the confirm code (or for that matter the complete link) is to curl https://drive.google.com/uc?export=download&id=FILE_ID and then extract the link under the "download anyway" button, which includes the confirm code.
Cheers.

you must disable virus scan from Chrome, but it will disable virus scan from all activities with the browser. In Chrome Preferences, show Advanced Settings and uncheck "Enable phishing and malware protection".

Related

Google API service account authentication can't find JSON credentials file

I can't get the Google API to find my service account's credentials. I downloaded the necessary JSON file with the right name into the proper place, and I'm using Python code straight off the API documentation:
import gspread
gc = gspread.service_account()
sh = gc.open("Example spreadsheet (I'll replace this with my actual sheet name later)")
print(sh.sheet1.get('A1'))
The code stops at gc = gspread.service_account() with a FileNotFoundError. I discovered via an error message that this is because it's looking at the complete wrong file path (I think it's thinking I'm on a Mac when I'm actually on a Windows PC??). Overriding the file name, i.e.
gc = gspread.service_account(filename="insert\actual\path\here.json"),
does not work either, which is the mystifying part. I copied that path straight out of my file explorer, doubled the backslashes so Unicode doesn't try to escape it all (that happened once), tried every modification on the file path I could think of (%APPDATA%\gspread\service_account.json instead of the whole thing, etc.) - what could be going wrong?
Edit: #mods, feel free to close the question! I found the issue, which is that I was using the Repl.it online coding environment instead of a local one. I ported everything over to IDLE and it worked fine. I strongly suspect Repl.it just couldn't access my local files at all (I also tried it on Repl.it with a random screenshot in a different place, and it threw the same error).

Download Using Google Drive API with the original filename and extension

As the Google Drive API document said about downloading a file:
https://www.googleapis.com/drive/v3/files/FILEID?alt=media%26key=API_KEY
If we paste this link to Chrome or Safari It will start downloading.
But the problem is
The name is changed to FIELDID
The extension is gone
For example
I have file mywork.fbx I upload to google drive, and the FileID is ABCDEFG
Then I go to the link below.
https://www.googleapis.com/drive/v3/files/ABCDEFG?alt=media%26key=MYAPIKEY
I got the file that name is ABCDEFG without extension
It should be mywork.fbx or anyname.fbx not just ABCDEFG
Tried
add &download="mywork.fbx"
use PHP header('Content-Disposition: attachment; filename="mywork.fbx"'); filename is mywork.fbx but the bandwidth is also mine too It's not only Google Drive!!!
$file_url = 'https://www.googleapis.com/drive/v3/files/ABCDEFG?alt=media&key=KEY';
header('Content-Disposition: attachment; filename="mywork.fbx"');
readfile($file_url);
check articles in stack overflow but I can't found the right one
You want to download a file which is not Google Docs using the browser.
You want to download a file with the filename which has the filename and extension of the original file.
You are using the API key.
In this case, the file is publicly shared.
If my understanding is correct, how about this answer? In this answer, webContentLink is used as the endpoint. The official document says as follows.
webContentLink:
A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials.
Modified endpoint:
Please try to access the following endpoint with your browser.
https://drive.google.com/uc?export=download&id={fileId}
When you use this, please set the file ID. In this case, the file is not Google Docs.
When it accesses to the above endpoint, the file with the filename can be retrieved.
Reference:
Files of Drive API
If I misunderstood your question and this was not the direction, I apologize.
Look at the originalFilename property of https://developers.google.com/drive/api/v3/reference/files. You can use that in a content disposition header, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition

Google Drive API v3 : there isn't any way to get a download url for a google document?

The Google Drive API v2 to v3 migration guide says:
The exportLinks field has been removed from files. To export Google Documents, use the files.export method instead.
I don't want to export (download) the file right away. "files.export" will actually download the file. I want a link to download the file, later. This was possible in v2 by means of the exportLinks.
How can I in v3 accomplish the same? If it is not possible, why was this useful feature removed?
Besides, (similar problem to above) downloadUrl was also removed, and the suggested alternative ("files.get with ?alt=media") downloads the file instead of providing a download link. This means there is no way in v3 to get a public short lived URL for a file?
EDIT:
there is no way in v3 to get a public short lived URL for a file?
For regular files, apparently yes.
This seems to work fine (a public short lived link to the file with its right name and contents):
https://www.googleapis.com/drive/v3/files/ID?alt=media&access_token=TOKEN
For google apps files, no (not even private, as v2 exportLinks used to be).
https://www.googleapis.com/drive/v3/files/ID/exportmimeType=TYPEv&access_token=TOKEN
Similar to regular files, this URL is a short lived link to the file contents, but lacking of its right name.
BTW, I see the API is not behaving consistently: /drive/v3/files/FILEID delivers the right file name, but /drive/v3/files/FILEID/export does not.
I think the API itself should be setting the right Content-Disposition, as it is apparently doing when issuing a /drive/v3/files/FILEID call.
This file naming problem invalidates the workaround to the lack of ExportLinks in v3.
The v2 ExportLinks allowed me to link a file (which is not the same as getting its content right away). Anyone logged in and with the proper permissions was able to access it, and the link didn't needed any access_token, and it wasn't short lived. It was good and useful.
Building a link with a raw API call like /drive/v3/files/FILEID/export (with mandatory access_token) would be an close enough workaround (it is temporary and public, not the same as it was, anyway). However, the naming problem invalidates it.
In v2, regular files have a WebContentLink and google apps files have exportLinks. In v3 exportLinks are gone, and I don't see any suitable alternative to them.
Once you query for your file by id you can use the function getWebContentLink() to get the download link of the file (eg. $file->getWebContentLink() ).
I think you're placing too much emphasis on the word "method".
There is still a link to export a file, it's https://www.googleapis.com/drive/v3/files/fileIdxxxxx/export&mimeType=xxxxx/xxxxx. Make sure you URL encode the mime type.
Eg
https://www.googleapis.com/drive/v3/files/1fGBQ81haNU_nEiC5GITZD3bxT0ppL2LHg-C0ubD4Q_s/export?mimeType=text/csv&access_token=ya29.Gmo0BMvO-pVEPKsiD9j4D-NZVGE91MChRvwOcBSg3cTHt5uAClf-jFxcovQScbO2QQhwHS95eSGW1eQQcK5G1UQ6oI4BFEJJkntEBkgriZ14GbHuvpDL7LT2pKA--WiPuNoDDIuZMm5lWtlr
These links form part of the API, so the expectation is that you've written a client that sends authenticated requests, and deals with the response data. This explains why, if you simply paste the link into a browser without an access_token, it will fail. It also explains why the filename is export, ie. it isn't intended that your client would ever use a filename, but rather it should receive the data as a stream. This SO answer discusses the situation in more detail How to set name of file downloaded from browser?

Dredd can't find my API documentation, how do i tell it where it is if it's not on my local drive (it's on apiary.io server)

I am using the Dredd tool to test my API (which resides on apiary.io).
Question
I would like to provide dredd with a path to my documentation (it even asks for it), however my API doc is on apiary.io but i don't know the exact url that points to it. What would be the correct way to provide dredd with the API path?
What did work (but not what i'm looking for)
Note: I tried downloading the api to my local drive and providing dredd with a local path to the file (yml or apib) which works fine (yay!), but i would like to avoid keeping a local copy and simply providing dredd with the location of my real API doc which is being maintained on the apiary server.
How do I do this (without first fetching the file to local drive)?
Attempts to solve this that failed
I also read (and tried) on the following topics, they may be relevant but i wasn't successful in resolving the issue
- Using authentication token as environment variable
- Providing the domain provided by apiary.io//settings to dredd
- Providing the in the dredd command
all of these attempts still produces the same result, Dredd has no idea where to find the API document unless i provide a path in my local computer to the file (which i have to download or create manually on my computer first).
Any help is appreciated, Thanks!
If I understand it correctly, you would like to use dredd and feed it using the API description document residing on Apiar.io platform, right?
If so, you should be able to do that simply calling the init command with the right options:
dredd init -r apiary -j apiaryApiKey:privateToken -j apiaryApiName:sasdasdasd
You can find the private token going into the Test section of the target API (you'll find the button on the application header).
Let me know if this solves the problem for you - I'll make sure to propagate this and document it accordingly on our help page
P.S: You can also use your own reporter - in that case, simply omit -r apiary when writing the command line parameters.
You can feed Dredd not only with a path to file on your disk, but also with an URL.
If your API in Apiary is public, the API description document (in this case API Blueprint) should have a public URL. For example, if you go to http://docs.apiblueprintapi.apiary.io/, you can see on the left there is a Download link. Unfortunately, the link is visible only for users who do not have access to the editor of the API, so you can’t see the link if you’re owner of the API. Try to log out from Apiary and the link should appear:
Then you can feed Dredd with the link:
$ dredd 'http://docs.apiblueprintapi.apiary.io/api-description-document' 'http://example.com:8080/api'
I agree this isn’t very intuitive and since you’re not the first one to come up with this, I think we’ll think of some ways how to make it easier.
If your API isn't public then unfortunately there's no way to get the URL as of now. However, you can either use GitHub Sync or Apiary CLI to get the file on your disk in an automated manner.

can you load external executable javascript from a firefox extension?

Does anyone know if there is a way to load any external executable javascript from a firefox add-on extension? I looked into scriptloader.loadSubScript, but it appears that it can only load from a local resource.
Any help would be appreciated.
You can always xhr for a file, save the contents to disk, then use scriptloader.loadSubScript with an add-on
this would violate the AMO policies though, so you wouldn't be able to upload the add-on to http://addons.mozilla.org
As #erikvold already pointed out, doing so would be a security hazard AND it also violates AMO rules (because it is a security hazard).
Consider your server gets compromised, or there is a way to MITM the connection retrieving the remote script (TLS bugs anyone :p), or you sell your domain and the new owner decides to ship a script to collect credit card information straight from a user's hard disk...
However, it is possible to run a remote script in an unprivileged environment, much like it would run in a website.
Create a Sandbox. The Sandbox should be unprivileged, e.g. pass an URL in your domain into the constructor.
Retrieve your script, e.g. with XHR.
Evaluate your script in the Sandbox and pull out any data it might have generated for you.
This is essentially what tools like Greasemonkey (executing user scripts) do.
Creating and working with Sandboxes in a secure fashion is hard, and the Sandbox being unprivileged prohibits a lot of use cases, but maybe it will work for your stuff.
Try using Components.utils.import .
Example :
const {Cc,Ci,Cu} = require("chrome");
Cu.import("url/path of the file");
Note :
js file which uses DOM objects like window, navigator, etc. will return error saying "window/navigator is undefined". This is simply because the main.js code does not have access to DOM.
Refer this thread for more information.

Resources