Skip to content

Instantly share code, notes, and snippets.

@ninja33
Created March 7, 2019 05:42
Show Gist options
  • Save ninja33/03af88c66f9ef019b03ea27cbb06fb78 to your computer and use it in GitHub Desktop.
Save ninja33/03af88c66f9ef019b03ea27cbb06fb78 to your computer and use it in GitHub Desktop.
get Youdao word translation in one statement
var word = 'test';
fetch('https://dict.youdao.com/w/'+word).then(r=>r.text()).then(html=>{console.log((new DOMParser()).parseFromString(html, 'text/html').querySelector('#phrsListTab .trans-container').textContent)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment