You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
705 B
32 lines
705 B
module.exports = async (params) => { |
|
|
|
var o_params = { |
|
word: 'home', |
|
url: 'https://fy.iciba.com/ajax.php?a=fy&f=en&t=zh&w=' |
|
} |
|
|
|
Object.assign(o_params, params); |
|
|
|
var o = []; |
|
|
|
const request = require('request'); |
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
request(o_params.url+o_params.word, (err, res, body) => { |
|
if(err){ |
|
reject(err); |
|
}else{ |
|
try{ |
|
|
|
let data = JSON.parse(res.body); |
|
resolve(data.content.out); |
|
}catch(e){ |
|
reject(e); |
|
} |
|
reject('other error..'); |
|
} |
|
}); |
|
}); |
|
} |
|
|
|
|