Skip to content

Instantly share code, notes, and snippets.

@wmh
Last active July 31, 2018 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmh/1fed93d0477f60e551979995a65d960a to your computer and use it in GitHub Desktop.
Save wmh/1fed93d0477f60e551979995a65d960a to your computer and use it in GitHub Desktop.
Convert Binance assets to SQL statment
// https://www.binance.com/userCenter/balances.html
var sql = 'INSERT INTO token_mappings (src, name, coin_name, image_url) VALUES \n';
document.querySelectorAll('ul.accountInfo-lists > li.td > div').forEach((row) => {
const imgURL = row.querySelector('div.coin > img').getAttribute('src');
const coin = row.querySelector('div.coin').textContent.trim();
const fullname = row.querySelector('div.fullName').textContent.trim();
sql += `('binance', '${coin}', '${fullname}', '${imgURL}'),\n`;
});
console.log(sql);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment