Skip to content

Instantly share code, notes, and snippets.

@FreePhoenix888
Last active December 12, 2024 08:22
Show Gist options
  • Save FreePhoenix888/9c1a1a143ef00d4455d7ea315fc3c433 to your computer and use it in GitHub Desktop.
Save FreePhoenix888/9c1a1a143ef00d4455d7ea315fc3c433 to your computer and use it in GitHub Desktop.
Export watcher data
// Open the watcher website and execute this command in the browser console
const allData = []
const dayColumns = document.querySelectorAll(`.day`)
for (const dayColumn of dayColumns) {
const date = dayColumn.querySelector(`.day-header__date`)
const loggedTimes = dayColumn.querySelectorAll(`.logged-time`)
for (const loggedTime of loggedTimes) {
const subtitle = loggedTime.querySelector(`.logged-time-header__subtitle`).children[0]
const time = loggedTime.querySelector(`.logged-time-header__time`)
const data = {date: date.textContent, time: time.textContent, description: subtitle.textContent}
allData.push(data)
}
}
// You can log json itself instead of this text. I have mapped it to have less text
console.log(allData.map(data => `${data.date}|${data.time}|${data.description}`).join(`\n`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment