Created
May 26, 2023 11:56
-
-
Save danferns/66e41f0708a0ac641ff79a1bb6414692 to your computer and use it in GitHub Desktop.
A workaround to download Dropbox folders that are too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $dropboxLinks = Get-Content -Path .\dropboxlinks.json | ConvertFrom-Json | |
| foreach ($entry in $dropboxLinks.PSObject.Properties) { | |
| $fileName = $entry.Name | |
| $downloadUrl = $entry.Value -replace '0$', '1' | |
| Invoke-WebRequest -Uri $downloadUrl -OutFile $fileName | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A workaround to download Dropbox folders that are too large, the 'zip file is too large' error. | |
| // Fetch the links to all individual files in the folder and then download them one by one with a shell script. | |
| // How to use | |
| // Run this script in the devtools console for the dropbox folder. Make sure to use the detailed list UI view | |
| // The script will scroll to the bottom of the page every few seconds to load all the files. | |
| // It'll stop after doing that a number of times (scrollAttempts), then it will dump all the links in the console. | |
| // Copy that object (right click -> copy object on chrome) | |
| // Create a file called 'dropboxlinks.json' and paste the object you copied. | |
| // Next to actually download the files, use the dbxdl.ps1 script that came in this gist. | |
| // An easy way is to download it in the same folder as dbxcli, open the powershell in that folder, and run the script: | |
| // ./dbxdl.ps1 | |
| // this should start downloading all the files one at a time. | |
| function scrollToButtom() { | |
| const container = document.querySelector("._sl-page-container_13uuq_13"); | |
| container.scrollTo(0, container.scrollHeight); | |
| } | |
| function collectLinks() { | |
| const table = document.querySelector(".mc-table-body"); | |
| const links = {}; | |
| for (const tableRow of table.children) { | |
| const link = tableRow.children[0].children[2].href; | |
| const name = tableRow.children[0].children[1].children[0].innerText; | |
| links[name] = link; | |
| } | |
| console.log(links); | |
| } | |
| // feel free to adjust these values based on your needs | |
| const interval = 3000; | |
| const scrollAttempts = 50 | |
| for (let i = 0; i < scrollAttempts; i++) { | |
| setTimeout(scrollToButtom, interval * i); | |
| } | |
| setTimeout(collectLinks, scrollAttempts * interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment