Skip to content

Instantly share code, notes, and snippets.

@wmh
Created July 31, 2018 09:28
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/f568b1d7154012febd0e3a150713e9a2 to your computer and use it in GitHub Desktop.
Save wmh/f568b1d7154012febd0e3a150713e9a2 to your computer and use it in GitHub Desktop.
Convert cobinhood assets to SQL
// https://cobinhood.com/funds
var sql = 'INSERT INTO token_mappings (src, name, coin_name, image_url) VALUES \n';
document.querySelectorAll('div.sc-AUpyg > div.sc-cSYcjD').forEach((row) => {
const name = row.querySelector('span.sc-gjAXCV').textContent.trim();
const svg = window.btoa(new XMLSerializer().serializeToString(row.getElementsByTagName('svg')[0]));
const fullname = row.querySelector('span.sc-iybRtq').textContent.trim();
sql += `('cobinhood', '${name}', '${fullname}', '${svg}'),\n`;
});
console.log(sql);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment