Skip to content

Instantly share code, notes, and snippets.

@licensed
Created October 31, 2017 20:11
Show Gist options
  • Save licensed/41e609e6b8f8cfe412d7a3dc30698066 to your computer and use it in GitHub Desktop.
Save licensed/41e609e6b8f8cfe412d7a3dc30698066 to your computer and use it in GitHub Desktop.
Save chrome download list
#01: Open console Ctrl+Shift+J
#02: Past the code below
#03: Save the list
ditems = document.querySelector("downloads-manager").shadowRoot.querySelector("iron-list").querySelectorAll("downloads-item");
var div = document.createElement('div');
[].forEach.call(ditems, function (el) {
var br = document.createElement('br');
var hr = document.createElement('hr');
div.appendChild(el.shadowRoot.querySelector("#url"));
div.appendChild(br)
div.appendChild(hr)
});
document.body.innerHTML=""
document.body.appendChild(div);
document.head.style.innerHTML=""
@sunildhillon
Copy link

This fetches only 50 links. Chrome seems to hide items when we scroll.

@licensed
Copy link
Author

licensed commented Jan 7, 2020

This fetches only 50 links. Chrome seems to hide items when we scroll.

Oh, i think this code stops to work correctly. I am sorry.

@sunildhillon
Copy link

sunildhillon commented Jan 7, 2020 via email

@ProximaNova
Copy link

ProximaNova commented May 23, 2022

Edit which allows you to save the filenames too:

//Open the console Ctrl+Shift+J. Paste the code below and press enter. Save the list.

ditems = document.querySelector("downloads-manager").shadowRoot.querySelector("iron-list").querySelectorAll("downloads-item");

var div = document.createElement('div');

[].forEach.call(ditems, function(el0) {
el0.shadowRoot.querySelector("#name").removeAttribute("hidden");
el0.shadowRoot.querySelector("#name").style.display = "block";
});

[].forEach.call(ditems, function(el) {
var br = document.createElement("br");
var hr = document.createElement("hr");
div.appendChild(el.shadowRoot.querySelector("#name"));
div.appendChild(el.shadowRoot.querySelector("#url"));
div.appendChild(br);
div.appendChild(hr);
});

document.body.innerHTML="";
document.body.appendChild(div);
document.head.style.innerHTML="";

This code maybe could be shorter, but whatever.

There is still the problem that this only shows 8 items from the list.

@ProximaNova
Copy link

Bug fixed: truncated links

Only show the full links:

//Open the console Ctrl+Shift+J. Paste the code below and press enter. Save the list.

ditems = document.querySelector("downloads-manager").shadowRoot.querySelector("iron-list").querySelectorAll("downloads-item");

var div = document.createElement('div');

[].forEach.call(ditems, function(el) {
el.shadowRoot.querySelector("#name").removeAttribute("hidden");
el.shadowRoot.querySelector("#name").style.display = "block";
el.shadowRoot.querySelector("#url").innerHTML = el.shadowRoot.querySelector("#url").href;
var br = document.createElement("br");
var hr = document.createElement("hr");
div.appendChild(el.shadowRoot.querySelector("#name"));
div.appendChild(el.shadowRoot.querySelector("#url"));
div.appendChild(br);
div.appendChild(hr);
});

document.body.innerHTML = "";
document.body.appendChild(div);
document.head.style.innerHTML = "";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment