Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /*
=== INSTRUCTIONS ===

1. Open Amazon wishlist page
    
2. Make sure all items are loaded. You may have to scroll for a long time if your list is long. Scroll until the **END OF LIST** marker is shown. 
    
3. Once all items are loaded, copy and paste the script below into the console, followed by hitting the `enter`/`return` key
 - On Chrome console can be found via: ` Ctrl + Shift + J (Windows / Linux)` or `Cmd + Opt + J (Mac)`
 - On Safari via: `Option + Cmd + C`
 - On Firefox via: `Ctrl + Shift + K` or	`Cmd + Opt + K`
   

4. The page will turn into a formatted table of your items. You now have a few options: 
 - select all the items w/ `ctrl + a` and paste it directly into an Excel sheet. 
 - save the webpage as an HTML document/archive page/PDF (book marking will not work!)
 - other ideas I may not be thinking off 
*/


// Capture wishlist items
function scrape(){
var c = document.querySelectorAll(".g-item-sortable");
var books = [];
for (var i = 0; i < c.length; i++) {
  var book = {};
  var id = c[i].getAttribute("data-itemid");
  book["n"] = i;
  book["id"] = id;
  try {
    book["title"] = c[i].querySelector("#itemName_" + id).title;
  } catch (err) {
    book["title"] = "";
  }

  try {
    book["link"] = c[i].querySelector("#itemName_" + id).href;
  } catch (err) {
    book["link"] = "";
  }

  try {
    book["author"] = c[i].querySelector("#item-byline-" + id).innerText;
  } catch (err) {
    book["author"] = "";
  }
  try {
    book["image"] = c[i].querySelector("#itemImage_" + id + " img").src;
  } catch (err) {
    book["image"] = "";
  }

  try {
    book["itemAddedDate"] = c[i]
      .querySelector("#itemAddedDate_" + id)
      .innerHTML.match(/\<\/span\>(.+)/)[1];
  } catch (err) {
    book["itemAddedDate"] = "";
  }

  try {
    book["asin"] = JSON.parse(
      c[i].getAttribute("data-reposition-action-params")
    ).itemExternalId.match(/ASIN:(.+?)\|/)[1];
  } catch (err) {
    book["asin"] = "";
  }
  books.push(book);
}

// Clear site
document.body.innerText = "";


// Build table w/ wishilist items 
function maketd(val) {
  var td = document.createElement("td");
  td.innerHTML = val.trim()
  return td;
}

var table = document.createElement("table");
table.style.margin="10px";

var head = document.createElement("tr");
table.appendChild(head);

var head_dateAdded = document.createElement("th");
head_dateAdded.innerText = "Date Added";
head.appendChild(head_dateAdded);

var head_image = document.createElement("th");
head_image.innerText = "Image";
head.appendChild(head_image);

var head_title = document.createElement("th");
head_title.innerText = "Title";
head.appendChild(head_title);

var head_author = document.createElement("th");
head_author.innerText = "Author";
head.appendChild(head_author);

var head_asin = document.createElement("th");
head_asin.innerText = "ASIN/ISBN";
head.appendChild(head_asin);

var head_link = document.createElement("th");
head_link.innerText = "Link";
head.appendChild(head_link);

for (var i = 0; i < books.length; i++) {
  let tr = document.createElement("tr");
  tr.appendChild(maketd(books[i].itemAddedDate));
  tr.appendChild(maketd(`<img src=${books[i].image}>`));
  tr.appendChild(maketd(books[i].title));
  tr.appendChild(
    maketd(books[i].author.replace("by ", "").replace(/\(.+?\)/, ""))
  );
  tr.appendChild(maketd(books[i].asin));
  tr.appendChild(maketd(`<a href='${books[i].link}'>Product Link</a>`));
  table.appendChild(tr);
}

document.body.appendChild(table);
}
              
            
!
999px

Console