Last active
February 9, 2022 14:29
-
-
Save itsazzad/2354b3e6a6cb33600b257a0b1c56f0f1 to your computer and use it in GitHub Desktop.
weather.com hourbyhour
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
var details = document.querySelectorAll("[id*='detailIndex']") | |
var data = { | |
daypart: [], | |
temperature: [], | |
UVIndex: [], | |
} | |
for (let i = 0; i < details.length; i++) { | |
details[i].toggleAttribute("open") | |
data.daypart.push(details[i].querySelector("[data-testid='daypartName']").textContent) | |
data.temperature.push(details[i].querySelector("[data-testid='TemperatureValue']").textContent) | |
data.UVIndex.push(parseInt(details[i].querySelector("[data-testid='UVIndexValue']").textContent.replace(' of 10', ''))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment