Last active
June 7, 2020 22:48
-
-
Save serginator/da8d6905f8963ff9220df69b39d2ec7a to your computer and use it in GitHub Desktop.
Recover zoom service status
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
const rp = require('request-promise'); | |
const cheerio = require('cheerio'); | |
let opt = { | |
uri: 'https://status.zoom.us', | |
transform: function (body) { | |
return cheerio.load(body); | |
} | |
} | |
rp(opt) | |
.then(function($) { | |
let out = [], | |
componentInnerContainer = $('.component-inner-container'); | |
$('.component-inner-container').each(function(i, item) { | |
let that = this; | |
if ($(this).data('componentStatus') == 'operational') { | |
if ($(this).data('jsHook') !== 'component-group-opener') { | |
out.push({ | |
text: $(this).children('.name').text().trim(), | |
value: $(this).children('.component-status').text().trim() | |
}); | |
} else { | |
let aux = []; | |
$(this).parent().children('.child-components-container').each(function(j, item2) { | |
$(this).find('.component-inner-container').each(function(k, item3) { | |
aux.push({ | |
text: $(this).children('.name').text().trim(), | |
value: $(this).children('.component-status').text().trim() | |
}); | |
}); | |
out.push({ | |
text: $(that).children('.name').text().trim(), | |
childs: aux | |
}); | |
}); | |
} | |
} | |
}); | |
console.log(out); | |
}) | |
.catch(function(e) { | |
console.log(e); | |
}); | |
/* | |
[ | |
{ | |
text: 'Zoom Meetings', | |
value: 'Operational', | |
}, | |
{ | |
text: 'Zoom Website', | |
childs: [ | |
{ | |
text: 'blabla', | |
value: 'Operational' | |
}, | |
{ | |
text: 'blabla2', | |
value: 'Operational' | |
} | |
] | |
} | |
] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment