Dropbox Direct Downloader

Convert Dropbox file sharing links to direct download links.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Dropbox Direct Downloader
// @namespace    https://github.com/tyhallcsu
// @version      1.0
// @description  Convert Dropbox file sharing links to direct download links.
// @author       sharmanhall
// @match        https://www.dropbox.com/s/*/*.*?dl=0
// @icon         https://api.iconify.design/mdi/dropbox.svg
// @homepageURL  https://github.com/tyhallcsu/
// @run-at       context-menu
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
    // Get the current URL of the Dropbox file sharing page.
    let dburl = window.location.href;

    // Replace "www" with "dl" to change the subdomain.
    let web = dburl.replace('www', 'dl');

    // Replace "dropbox" with "dropboxusercontent" to change the domain.
    let end = web.replace('dropbox', 'dropboxusercontent');

    // Remove the "?dl=0" query parameter from the URL.
    let final = end.substring(0, end.length - 5);

    // Navigate to the modified URL to directly download the shared file.
    window.location.assign(final);
})();