Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Prepare Google Chrome's download items for CLI tool, such as curl / wget / etc.
* @copyright Yi-Feng Tzeng <yftzeng@gmail.com>
* @license MIT License <https://spdx.org/licenses/MIT.html>
* @tutorial
* 1) In Google Chrome, use `Ctrl + j` to open "chrome://downloads/" tab.
* 2) Open "Chrome DevTools", press `F12`, and change to "Console" panel.
* 3) Paste all the contents here in "Console" panel, then press `Enter` key.
* 4) Copy output text in your COMMAND LINE.
* 5) Done, and have fun.
* @see {@link https://blog.gcos.me/post/2021-05-23_prepare-google-chrome-download-items-for-cli-tool-such-as-curl-wget/} for further information.
*/
items = document.querySelector("downloads-manager").shadowRoot.querySelector("iron-list").querySelectorAll("downloads-item");
[].forEach.call(items, function (item) {
command = "wget";
command_args = "-c -O";
name = item.shadowRoot.getElementById("name").innerText;
url = item.shadowRoot.getElementById("url").href;
console.log(command + " " + command_args + " '" + name + "' '" + url + "'");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment