Dropbox Direct Downloader

Convert Dropbox file sharing links to direct download links.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();