mirror of
https://github.com/Brandon-Rozek/Rozbot.git
synced 2024-11-07 20:30:34 -05:00
18 lines
448 B
JavaScript
18 lines
448 B
JavaScript
var cheeriop = require('../promise/cheerio.js');
|
|
var promise = require('promise-polyfill');
|
|
|
|
module.exports = function(html) {
|
|
return new promise(function(resolve, reject) {
|
|
cheeriop(html).then(function($) {
|
|
var response = $('#define').children().find('ul').children().first().text()
|
|
if (response) {
|
|
resolve(response);
|
|
} else {
|
|
reject("");
|
|
}
|
|
}).catch(function(error) {
|
|
console.log(error);
|
|
reject("");
|
|
})
|
|
});
|
|
}
|