Youdao Translation Command-Line Interface Using Youdao Api.
:D The code is ugly, and there are Suggestions for improvement.
git clone https://github.com/O1sInfo/ydapi.git
or Download as zip.- (Optional) Put yd.bat in your envoiroment path.
- Set some private value in yd.py such as
appKey
,secretKey
. May be you need a account. -> 有道API yd -h
for HELP.
yd -h
usage: yd.py [-h] [-w WORD | -t TEXT | -f FILE] [-o OUTPUT]
Youdao Translation CLI.
optional arguments:
-h, --help show this help message and exit
-w WORD the word to translate using yd-dict web interface.
-t TEXT the text to translate using yd-fanyi api.
-f FILE the file path of text to translate using yd-fanyi api.
-o OUTPUT to save the translatin file when -f effects.
yd -w word
n [语] 单词;话语;消息;诺言;命令, (Word)人名;(英)沃德
vt 用言辞表达
yd -t 这是一段很长的文本,但不要超过5000字。
这是一段很长的文本但不要超过5000字。
--------------------------------------------------------------------------------
This is a long piece of text but not more than 5,000 words.
yd -f \file\path\to\translate -o \file\path\to\save