Skip to content

Instantly share code, notes, and snippets.

@matchu
Last active August 4, 2020 21:53
Show Gist options
  • Save matchu/b6b27df6e11c6dfdc3ebb65529f833c0 to your computer and use it in GitHub Desktop.
Save matchu/b6b27df6e11c6dfdc3ebb65529f833c0 to your computer and use it in GitHub Desktop.
Dress to Impress - Export lists to CSV

Warning: The procedure I'm about to describe is dangerous! Copy-pasting code into the browser console can let attackers steal your data. Make sure to only paste in code from people you trust, on websites where you are okay with them seeing all your data!

  1. Open your Dress to Impress items page.
  2. Follow these instructions to open the Javascript Console for the page.
  3. Paste in the code shown on this page. It's labeled console-script.js.
  4. This should pop open a new window. If your popups are blocked, enable them.
  5. The new window should trigger a download of your items CSV!
var rows = [];
var lists = document.querySelectorAll(".closet-list");
for (var list of lists) {
var listName = list.querySelector("h4").innerText.trim();
var items = list.querySelectorAll(".object");
for (var item of items) {
var itemName = item.querySelector(".name").innerText.trim();
var quantity = item.querySelector(".quantity").innerText.trim();
rows.push({listName, itemName, quantity});
}
}
var csv = `List,Item,Quantity\r\n`;
var escape = str => `"${str.replace('"', '""')}"`;
for (var {listName, itemName, quantity} of rows) {
csv += `${escape(listName)},${escape(itemName)},${escape(quantity)}\r\n`;
}
var url = `data:text/csv;charset=utf-8;base64,${btoa(csv)}`;
window.open(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment