Greasy Fork is available in English.

Google Drive Direct Download Link

Добавляет кнопку для получения прямой ссылки на скачивание файла из Google Drive

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Google Drive Direct Download Link
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Добавляет кнопку для получения прямой ссылки на скачивание файла из Google Drive
// @author       Rodion & ChatGPT
// @match        https://drive.google.com/file/d/*
// @icon         https://ssl.gstatic.com/docs/doclist/images/infinite_arrow_favicon_5.ico
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

    // Проверка, что страница загружена
    function waitForElement(selector, callback) {
        const interval = setInterval(() => {
            const el = document.querySelector(selector);
            if (el) {
                clearInterval(interval);
                callback(el);
            }
        }, 500);
    }

    function getFileId() {
        const match = window.location.pathname.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);
        return match ? match[1] : null;
    }

    function createButton(fileId) {
        const button = document.createElement('button');
        button.innerText = '🔗 Получить прямую ссылку';
        button.style.cssText = `
            position: fixed;
            top: 80px;
            right: 20px;
            z-index: 9999;
            padding: 10px 14px;
            background-color: #0f9d58;
            color: white;
            border: none;
            border-radius: 5px;
            font-weight: bold;
            cursor: pointer;
        `;

        button.onclick = () => {
            const directLink = `https://drive.google.com/uc?export=download&id=${fileId}`;
            GM_setClipboard(directLink);
            alert("Прямая ссылка скопирована в буфер обмена:\n\n" + directLink);
        };

        document.body.appendChild(button);
    }

    const fileId = getFileId();
    if (fileId) {
        waitForElement('div[jscontroller]', () => {
            createButton(fileId);
        });
    }
})();