Extracts image URLs from a Dropbox page and copies them to the clipboard when a button is clicked.
This Tampermonkey script allows you to extract image URLs from a Dropbox folder page and copy them to your clipboard with a single click. The script adds a "Copy all URLs" button to the Dropbox page, and when you click the button, it scrolls through the entire folder, collects all image URLs, and copies them to your clipboard.
This is a userscript that extracts image URLs from a Dropbox page and copies them to the clipboard when a button is clicked. The script creates a button on the page that, when clicked, scrolls to the bottom of the page, waits for new images to load, and extracts the image URLs. The script then joins the URLs into a string separated by newlines. It then puts the links on your clipboard with ?dl=0 replaced with ?raw=1 parameters.
The power of extracting image URLs from a Dropbox folder page and copying them to your clipboard with a single click!
Floating button in the bottom right of your browser window:
Click the button and all image URLs are copied to your clipboard
Paste all your URLs:
https://raw.githubusercontent.com/tyhallcsu/dropbox-image-url-extractor/main/dropbox-image-bulk-url-extractor
) and click "Import."This Tampermonkey script allows you to extract image URLs from a Dropbox folder page and copy them to your clipboard with a single click. The script adds a "Copy all URLs" button to the Dropbox page, and when you click the button, it scrolls through the entire folder, collects all image URLs, and copies them to your clipboard.
Known bugs:
Version | Link | Alternative | Note |
---|---|---|---|
Userscript | Greasy Fork | Install (GitHub) | Work in Progress |
Chrome/Edge/Opera | GitHub | - | Work in progress |
Legacy | Gist | Link | - |
(Optional) Mobile Bookmarklet:
JSCopy code
javascript:(function(){['https://raw.githubusercontent.com/tyhallcsu/dropbox-image-url-extractor/main/dropbox-image-bulk-url-extractor'].map(s=>document.body.appendChild(document.createElement('script')).src=s)})();
Tested and compatible with Tampermonkey.
Nothing appears bottom right:
You can adjust the SECONDS_TO_WAIT_FOR_SCROLL
constant in the script to change the amount of time the script waits for new images to load after scrolling to the bottom of the page.
The Tampermonkey script is designed to automate the process of extracting image URLs from a Dropbox folder page and copying them to the user's clipboard. The script is executed as a userscript in the context of the browser's web page, and it operates by interacting with the Document Object Model (DOM) of the Dropbox page. Below is a technical explanation of how the script works:
- `SECONDS_TO_WAIT_FOR_SCROLL`: A constant that specifies the number of seconds the script should wait for new images to load after scrolling to the bottom of the page.
- `DOWNLOAD_URL_REPLACEMENT`: A constant that specifies the query parameter to be appended to the image URLs to enable direct download.
- `getImageLinks`: A function that queries the DOM for anchor elements (`<a>`) containing links to image files. It then extracts the `href` attribute of each anchor element, replaces the query parameter `?dl=0` with `?raw=1` to enable direct download, and returns an array of modified URLs.
- `waitForImagesToLoad`: An asynchronous function that programmatically scrolls to the bottom of the page and waits for a specified duration (defined by `SECONDS_TO_WAIT_FOR_SCROLL`) to allow new images to load.
The script creates an empty array imageUrls
to store the image URLs that will be extracted from the page.
The script dynamically creates a button element (<button>
) and appends it to the DOM. The button is styled and positioned in the bottom right corner of the page. The text content of the button is set to "Copy all URLs."
The script adds a click event listener to the button. When the button is clicked, the following actions are performed:
- The script enters a loop that continues until all image URLs have been extracted from the page. The loop is controlled by the `finished` variable, which is initially set to `false`.
- Within the loop, the script calls the `waitForImagesToLoad` function to scroll to the bottom of the page and wait for new images to load.
- The script then calls the `getImageLinks` function to extract the URLs of the newly loaded images. It filters out any URLs that have already been added to the `imageUrls` array to avoid duplicates.
- The script checks whether any new URLs were extracted in the current iteration. If no new URLs were extracted, it sets the `finished` variable to `true`, which will terminate the loop.
- The script keeps track of the total number of URLs extracted in the `numUrls` variable.
Once the loop is complete, the script concatenates the image URLs into a single string, separated by newline characters (\n
), and copies the string to the clipboard using the GM_setClipboard
function provided by the Tampermonkey API.
The script updates the text content of the button to indicate the number of URLs copied to the clipboard and temporarily disables the button for 3 seconds. After this duration, the button is re-enabled, and the text content is reset to "Copy all URLs."
The script leverages the Tampermonkey API, DOM manipulation, and asynchronous programming to automate the process of extracting image URLs from a Dropbox folder page and copying them to the user's clipboard. The script is designed to be compatible with the Dropbox web interface.
Tyler Hall Tech
This script is provided "as is" without warranty of any kind. Use it at your own risk. The author is not responsible for any consequences r###lting from the use of this script.
This project is licensed under the MIT License. See the LICENSE file for details.