Skip to content

Instantly share code, notes, and snippets.

@sunapi386
Created October 21, 2016 06:44
Show Gist options
  • Save sunapi386/b220469a8fb40e98436d019a3b128110 to your computer and use it in GitHub Desktop.
Save sunapi386/b220469a8fb40e98436d019a3b128110 to your computer and use it in GitHub Desktop.
// #bodyContent > div.mw-content-ltr > table:nth-child(21) > tbody > tr:nth-child(500)
//*[@id="bodyContent"]/div[4]/table[10]/tbody/tr[500]
// bgcolor="33CC33"
c=document.getElementById("bodyContent")
d=c.getElementsByClassName("mw-content-ltr")[0]
e=d.getElementsByTagName("table")
phoneTable=e[e.length - 4]
phoneBuilds = []
for (var i = 0; i < phoneTable.rows.length; i++) {
r = phoneTable.rows[i]
// Phones
if (r.childElementCount == 12 && r.cells[5].getAttribute("bgcolor") == "33CC33") {
// [device, product, build, version, date] = r.cells
device = r.cells[0]
product = r.cells[1]
build = r.cells[2]
version = r.cells[3]
date = r.cells[4]
rowOfInterest = [device.innerText, product.innerText, build.innerText, version.innerText, date.innerText]
phoneBuilds.push(rowOfInterest)
}
}
console.table(phoneBuilds)
watchTable=e[e.length - 1]
watchBuilds = []
for (i = 0; i < watchTable.rows.length; i++) {
r = watchTable.rows[i]
// Watch
if (r.childElementCount == 10 && r.cells[5].getAttribute("bgcolor") == "33CC33") {
// [device, product, build, version, date] = r.cells
device = r.cells[0]
product = r.cells[1]
build = r.cells[2]
version = r.cells[3]
date = r.cells[4]
rowOfInterest = [device.innerText, product.innerText, build.innerText, version.innerText, date.innerText]
watchBuilds.push(rowOfInterest)
}
}
console.table(watchBuilds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment