|
|
|
@ -2,7 +2,7 @@ module.exports = async (params) => { |
|
|
|
|
|
|
|
|
|
var o_params = { |
|
|
|
|
word: 'home', |
|
|
|
|
url: 'https://fy.iciba.com/ajax.php?a=fy&f=en&t=zh&w=', |
|
|
|
|
url: 'http://translate.google.com/translate_a/single?client=at&sl=en&tl=zh-CN&dt=t&q=', |
|
|
|
|
type: 'sentence' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -14,21 +14,21 @@ module.exports = async (params) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
request(o_params.url+encodeURI(o_params.word), (err, res, body) => { |
|
|
|
|
request('https://proxy.yimian.xyz/get/?url='+ Buffer.from(o_params.url+encodeURI(o_params.word), 'utf-8').toString('base64'), (err, res, body) => { |
|
|
|
|
if(err){ |
|
|
|
|
reject(err); |
|
|
|
|
}else{ |
|
|
|
|
try{ |
|
|
|
|
let data = JSON.parse(res.body); |
|
|
|
|
if(o_params.type == 'word'){ |
|
|
|
|
if(data.content.hasOwnProperty('word_mean')){ |
|
|
|
|
resolve(data.content.word_mean); |
|
|
|
|
if(true || data.content.hasOwnProperty('word_mean')){ |
|
|
|
|
resolve(data[0][0][0]); |
|
|
|
|
}else{ |
|
|
|
|
reject(); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(data.content.hasOwnProperty('out')){ |
|
|
|
|
resolve(data.content.out); |
|
|
|
|
if(true || data.content.hasOwnProperty('out')){ |
|
|
|
|
resolve(data[0][0][0]); |
|
|
|
|
}else if(data.content.hasOwnProperty('word_mean')){ |
|
|
|
|
resolve(data.content.word_mean); |
|
|
|
|
}else{ |
|
|
|
|