Greasy Fork is available in English.

Dropbox Direct Downloader

Convert Dropbox file sharing links to direct download links.

Autor
sharmanhall
Instalaciones diarias
2
Instalaciones totales
239
Calificaciones
0 0 0
Versión
1.0
Creado
30/4/2023
Actualizado
30/4/2023
Licencia
MIT
Funciona en

Dropbox Direct Downloader

This script is a userscript that modifies Dropbox file sharing links to directly download the shared file instead of opening the file preview page. Userscripts are small pieces of JavaScript code that run in the context of a web page and can modify the behavior or appearance of that page. Userscripts are typically installed and managed using browser extensions such as Greasemonkey or Tampermonkey.

Here's a breakdown of what this userscript does:

  • The script metadata at the top of the file specifies the script's name, author, version, description, and other information. Notably, the @match directive specifies that the script should only run on Dropbox URLs that match the pattern https://www.dropbox.com/s/*/*.*?dl=0. This pattern corresponds to Dropbox file sharing links with the dl=0 query parameter, which opens the file preview page.

  • The script specifies that it should run when the user selects the "Run script" option from the context menu (right-click menu) using the @run-at context-menu directive.

  • The script retrieves the current URL of the page using window.location.href.

  • It then performs a series of string replacements on the URL:

    • It replaces "www" with "dl" to change the subdomain.
    • It replaces "dropbox" with "dropboxusercontent" to change the domain.
    • It removes the last five characters from the URL, which corresponds to the "?dl=0" query parameter.
  • The script then uses window.location.assign(final) to navigate to the modified URL, which directly downloads the shared file.

Overall, this userscript provides a convenient way for users to directly download files from Dropbox sharing links by modifying the URL to bypass the file preview page. Note that the script is designed to run when the user selects the "Run script" option from the context menu, so it won't automatically run when the page loads.