diff --git a/lib/xeno-canto.js b/lib/xeno-canto.js index 0cd6004..8d592c0 100644 --- a/lib/xeno-canto.js +++ b/lib/xeno-canto.js @@ -9,7 +9,7 @@ 'use strict'; /** @dependencies */ -var rest = require('rest'); +var request = require('request'); /** @constructor */ function XenoCanto(){ @@ -93,12 +93,23 @@ XenoCanto.prototype.search = function(query, success){ }; function get(that, url, success){ - rest(url).then(function(response) { - // store response in instance var - that.entity = JSON.parse(response.entity); - success(that); - } - ); + + var opts = { + url: url, + method: 'GET', + timeout: (10*1000), + headers: + { + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163 Safari/537.36' + } + }; + + request(opts, function (err, res, url) { + // store response in instance var + that.entity = JSON.parse(res.body); + success(that); + }); + }