j113203 / Google Drive Download Virus Bypass

// ==UserScript==
// @name         Google Drive Download Virus Bypass
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  skip Google drive virus scan warning about large files
// @author       j113203
// @match        https://drive.google.com/uc?export=download*&id=*
// @match        https://drive.google.com/uc?id=*&export=download
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  console.log("starting to bypass");
  var link = document.getElementById("uc-download-link");
  var shouldClose = false;
  if (link) {
    console.log(`found link: ${link}`);

    var a_temp = document.createElement("a");
    a_temp.innerHTML = `<a href="${link}" target="_blank"/>`;
    a_temp.children[0].click();
    console.log(`trigger the link`);
    shouldClose = true;
  }

  if (document.body.innerText == "Not Found\nError 404") {
    shouldClose = true;
  }
  if (shouldClose) {
    window.close();
    console.log(`bye`);
  }

})();