Skip to content

Instantly share code, notes, and snippets.

@paulopatto
Last active February 29, 2020 16:02
Show Gist options
  • Save paulopatto/69d7d03ce1b325ca5b1bced41494212d to your computer and use it in GitHub Desktop.
Save paulopatto/69d7d03ce1b325ca5b1bced41494212d to your computer and use it in GitHub Desktop.
Snippet para pegar os tickers de FII do meu dashboard na corretora Rico.com.vc
/**
* Help resources:
*
* - https://medium.com/@chuckdries/traversing-the-dom-with-filter-map-and-arrow-functions-1417d326d2bc [best way]
* - https://css-tricks.com/snippets/javascript/loop-queryselectorall-matches/
* - https://stackoverflow.com/questions/47008384/es6-filter-an-array-with-regex
* - https://rubular.com/
*/
const tickers = []
const nlist = Array.from(document.querySelectorAll('table#tableAllocatedValue tbody tr td div'));
tickers = nlist.map( (node) => node.textContent).filter( (ticker) => ticker.match(/[\w]{4}11/) )
/// Clearing data with VIm:
/// - :%s/, /\0\r/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment