Skip to content

Instantly share code, notes, and snippets.

@itsazzad
Last active February 9, 2022 14:29
Show Gist options
  • Save itsazzad/2354b3e6a6cb33600b257a0b1c56f0f1 to your computer and use it in GitHub Desktop.
Save itsazzad/2354b3e6a6cb33600b257a0b1c56f0f1 to your computer and use it in GitHub Desktop.
weather.com hourbyhour
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