Công cụ download trực tiếp Google Drive

Tool get link tải xuống Google Drive
Vui lòng chờ 0 giây...
Cuộn xuống hoặc nhấp vào đây để chuyển đến liên kết
Chúc mừng! Liên kết được tạo

Xin chào các bạn, nhân dịp này mình sẽ chia sẻ công cụ Google Drive Generator mà các bạn có thể cài đặt trên blog của mình trên một trang tĩnh.

Công cụ download trực tiếp Google Drive
Công cụ download trực tiếp Google Drive

Từ đây chúng ta có thể tạo các Trình tạo công cụ phức tạp hơn. Đối với hướng dẫn, hãy xem các bước sau:

Bước 1: Trước hết Đăng nhập vào trang Blogger.

Bước 2: Trên bảng điều khiển Blogger, nhấp vào Trang.

Bước 3: Nhấp vào biểu tượng dấu cộng + bên cạnh nút 'TRANG MỚI'.

Bước 4: Nhấp vào 'Chế độ xem HTML'.

Bước 5: Sau đó sao chép mã từ tập lệnh bên dưới và dán nó vào đó.

<style>
/* Google Drive direct download by Giahuy.net */
.giahuy-gdrive{position:relative;display:block;margin:auto;padding:20px 0;max-width:800px;text-align:center;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:1.3}
.form-gdrive{position:relative;display:block}
.form-gdrive.output,.copy-reset-button{display:none}
.form-gdrive label{position:relative;display:block;margin:20px 0;font-size:16px;font-weight:600;color:#444}
.form-gdrive span{position:relative;display:block;margin-bottom:10px;font-size:12px;color:#444}
.form-gdrive input{position:relative;display:block;margin:auto;padding:10px 15px;width:calc(100% - 30px);background:#ebeff3;color:#444;border:none;outline:none;border-radius:5px}
.form-gdrive input:focus,.form-gdrive input:hover{background:#fff;border:1px solid #ebeff3}
.form-gdrive:after{position:absolute;content:"";left:0;bottom:0;background:#ce2c90;color:#fff;padding:5px 12px 7px 15px;border-radius:5px 0 0 5px;font-size:15px;line-height:2;z-index:2}
.form-gdrive.input input{width:100%;padding:10px 15px 10px 70px}
.form-gdrive.output input{width:100%;padding:10px 15px 10px 70px}
.form-gdrive.input:after{content:"Links:"}
.form-gdrive.output:after{content:"Links:"}
button#get-button{color:#fff;background-color:#ce2c90;display:inline-block;text-align:center;cursor:pointer;outline:none;border:none;border-radius:6px;font-size:15px;font-weight:bold;padding:8px 15px;margin:0 auto}
button#copy,button#download,button#reset{color:#fff;background-color:#ce2c90;display:inline-block;text-align:center;cursor:pointer;outline:none;border:none;border-radius:6px;font-size:14px;font-weight:bold;padding:8px 15px;margin:0 auto}
</style>

<!--[ Google Drive direct download by Giahuy.net ]-->
<div class='giahuy-gdrive'>
  <div class='form-gdrive input'>
    <input name='gdrive' id='driveID' placeholder='https://drive.google.com/file/d/1kUXF...' type='text'/>
  </div>
  <br>
  <div class='get-button'>
    <button id='get-button'>Create Direct Link</button>
  </div>
  <div class='form-gdrive output'>
    <input name='gdrive' id='output' placeholder='https://drive.google.com/file/d/0Bz4YdwRI3rnCMFRoTmtSS0M1VHM/view?usp=sharing' type='text' readonly='readonly'/>
  </div>
  <br>
  <div class='copy-reset-button'>
    <div id='text-caption'></div>
    <button id='copy'>Copy Link</button>
    <button id='download'>Download</button>
    <button id='reset'>Reset</button>
  </div>
</div>

<script>
  //<![CDATA[ /* Google Drive direct download by Giahuy.net */
  function getButton(){
    var input = document.getElementById("driveID").value,
        drive = input.indexOf("google.com");
    if (-1 != drive) {
        var textd = input.indexOf("d/"),
            textEdit = input.indexOf("/edit"),
            driveID = input.slice(textd + 2, textEdit),
            output = "https://docs.google.com/$type/d/" + driveID + "/export?format=pdf";
        -1 !== input.indexOf("document")
            ? (output = output.replace("$type", "document").split("pdf").join("docx"))
            : -1 !== input.indexOf("spreadsheet")
            ? (output = output.replace("$type", "spreadsheets").split("pdf").join("xlsx"))
            : -1 !== input.indexOf("presentation")
            ? (output = "https://drive.google.com/uc?export=download&id=" + (driveID = input.slice(textd + 2, textEdit)))
            : ((textEdit = input.indexOf("/view")), (output = "https://drive.google.com/uc?export=download&id=" + (driveID = input.slice(textd + 2, textEdit))));
      document.getElementById("output").value = output;
      document.querySelector(".input").style.display = "none";
      document.querySelector(".output").style.display = "block";
      document.querySelector(".copy-reset-button").style.display = "block";
      document.getElementById("get-button").style.display = "none";
    } else {
      document.getElementById("driveID").value = "Url không khớp với định dạng";
    }
  }
  function copy(){
    document.getElementById("output").select();
    document.execCommand('copy');
    document.getElementById("text-caption").innerHTML = "Đã sao chép liên kết thành công";
    document.getElementById("text-caption").style.margin = "10px 0";
  }
  function download(){
    var linkDownload = document.getElementById("output").value;
    window.open(linkDownload,'_blank');
  }
  function reset(){
    window.location.href = window.location.href;
  }
  window.onload = function() {
    document.getElementById("driveID").focus(), document.getElementById("get-button").onclick = getButton,
      document.getElementById("copy").onclick = copy, document.getElementById("download").onclick = download, 
      document.getElementById("reset").onclick = reset;
  };
  //]]>
</script>

Bước 6: Đặt tiêu đề cho trang, sau đó Xuất trang bằng cách nhấp vào Xuất bản.

Trên đây là hướng dẫn công cụ download trực tiếp Google Drive.
Nếu có bất cứ thắc mắc nào hãy comment ngay phía dưới cho mình biết nhé!

Copyright © www.giahuy.net

Tôi là Nhật Nguyễn, một kỹ sư xây dựng. Nhưng thích tìm hiểu về mã nguồn lập trình web ☏.