Created
March 7, 2019 05:42
-
-
Save ninja33/03af88c66f9ef019b03ea27cbb06fb78 to your computer and use it in GitHub Desktop.
get Youdao word translation in one statement
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
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