Skip to content

Instantly share code, notes, and snippets.

@multimeric
Last active December 12, 2022 04:45
Show Gist options
  • Save multimeric/a4fd75ee46ba563ed45f05defcfa9483 to your computer and use it in GitHub Desktop.
Save multimeric/a4fd75ee46ba563ed45f05defcfa9483 to your computer and use it in GitHub Desktop.
Script to create a CSV out of the Cart Review Page of TCGPlayer
(function(){
let str = ''
let tables = Array.from($('.sellerWrapMarket'))
for (let table of tables){
let $table = $(table)
let rows = Array.from($table.find('table.sellerTable'))
for (let row of rows){
let $row = $(row)
// Card name
str += $row.find('.itemsContents h3').text() + '\t'
// Card condition
str += $($row.find('.detailsContents p').get(1)).text().trim().replace('\n', '') + '\t'
// Card set
str += $row.find('.itemsContents p').text() + '\t'
// Price
str += $row.find('.priceBox').text().trim() + '\t'
// Quantity
str += $row.find('.qtyBox').text().trim() + '\n'
}
}
console.log(str)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment