-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
尝试修复有道逆向抽风
- Loading branch information
Showing
1 changed file
with
3 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ async function Translate(text, source_lang, target_lang) { | |
"Cookie": "[email protected]; OUTFOX_SEARCH_USER_ID_NCOO=1;" | ||
}; | ||
|
||
|
||
const resp = await axios.post(url, m, { headers }); | ||
const resp_text = resp.data; | ||
|
||
|
@@ -61,16 +62,8 @@ async function Translate(text, source_lang, target_lang) { | |
l += r.final('utf-8'); | ||
|
||
const t = JSON.parse(l); | ||
|
||
let ans = ""; | ||
for (let index = 0; index < t["translateResult"][0].length; index++) { | ||
const translation = t["translateResult"][0][index]; | ||
if (translation && translation["tgt"]) { | ||
ans += translation["tgt"]; | ||
} | ||
} | ||
|
||
return ans | ||
console.log(t); | ||
return t.translateResult.map(item => item.tgt).join(''); | ||
} | ||
|
||
async function youdaoTranslate(text, source_lang, target_lang) { | ||
|