Last active
January 9, 2021 05:50
-
-
Save drmad/d4c3f96e6bab489c27bd8cefe7ede390 to your computer and use it in GitHub Desktop.
Convierte la web de tipo de cambio de la SUNAT a un JSON, ahora que le han añadido recaptcha :-P
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res = [] | |
document.querySelectorAll('td.js-cal-option').forEach(e => { | |
buy_el = (e.querySelector('div.normal-all-day')) | |
sell_el = (e.querySelector('div.pap-all-day')) | |
if (buy_el && sell_el) { | |
res.push({ | |
day: parseInt(e.querySelector('div.date').innerHTML.trim()), | |
buy: parseFloat(buy_el.childNodes[1].textContent.trim()), | |
sell: parseFloat(sell_el.childNodes[1].textContent.trim()), | |
}) | |
} | |
}) | |
console.log(JSON.stringify(res)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment