Created
February 15, 2016 17:33
-
-
Save sandrinodimattia/ff283b6a15c5f1b343cb to your computer and use it in GitHub Desktop.
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
"use latest"; | |
const howMany = function(cb) { | |
var options = { | |
url: 'https://auth0.com/about', | |
qs: { | |
'_escaped_fragment_': '' | |
}, | |
headers: { | |
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36' | |
} | |
}; | |
require('request').get(options, (err, res, html) => { | |
if (err) { | |
return cb(err); | |
} | |
if (res.statusCode !== 200) { | |
return cb(new Error('Unexpected status code: ' + res.statusCode)); | |
} | |
var $ = require('cheerio').load(html); | |
cb(null, $('#meet-the-team article > div.profile > h4').length); | |
}); | |
}; | |
module.exports = (ctx, done) => { | |
howMany((err, total) => { | |
console.log(err); | |
if (err) { | |
return done(err); | |
} | |
return done(null, { | |
response_type: 'in_channel', | |
text: `I can see ${total} Authziros on the <https://auth0.com/about|About page>.` | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment