Skip to content

Instantly share code, notes, and snippets.

@serginator
Last active June 7, 2020 22:48
Show Gist options
  • Save serginator/da8d6905f8963ff9220df69b39d2ec7a to your computer and use it in GitHub Desktop.
Save serginator/da8d6905f8963ff9220df69b39d2ec7a to your computer and use it in GitHub Desktop.
Recover zoom service status
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