All Projects → longcw → Youdao

longcw / Youdao

基于python 的命令行下查词工具,使用有道api

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Youdao

fy
🌐 Translate words via command line
Stars: ✭ 37 (-79.33%)
Mutual labels:  youdao
Ydict
Yet another command-line youdao dictionary for geeks!
Stars: ✭ 318 (+77.65%)
Mutual labels:  youdao
Chrome Extensions Youdaowithwordnode
有道词典chrome划词插件,原版不带生词本,在其源码基础上,添加了添加生词本的功能,生词本用的有道官方API
Stars: ✭ 74 (-58.66%)
Mutual labels:  youdao
youdao
有道词典网页爬虫
Stars: ✭ 22 (-87.71%)
Mutual labels:  youdao
Many-Translaters
谷歌翻译,360翻译,iCIBA翻译,有道翻译,免费API
Stars: ✭ 121 (-32.4%)
Mutual labels:  youdao
Mtrans
Multi-source Translation
Stars: ✭ 711 (+297.21%)
Mutual labels:  youdao
terminal-translate
a terminal-translate tool
Stars: ✭ 73 (-59.22%)
Mutual labels:  youdao
Youdao Collins Chrome Extension
A chrome extension to help you search english words in collins dict.
Stars: ✭ 112 (-37.43%)
Mutual labels:  youdao
Translators
🌏🌍🌎Translators🌎🌍🌏 is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python. Translators是一个旨在用Python为个人和学生带来免费、多样、愉快翻译的库。
Stars: ✭ 295 (+64.8%)
Mutual labels:  youdao
Popup Dict
Linux 下的划词翻译小工具
Stars: ✭ 69 (-61.45%)
Mutual labels:  youdao
gdict
A command line dictionary written in golang powered by multi engines.
Stars: ✭ 21 (-88.27%)
Mutual labels:  youdao
weixin python
微信公众号开发,python Flask
Stars: ✭ 18 (-89.94%)
Mutual labels:  youdao
Codevar
生成可用的代码变量 (CodeVar that return u a better variable from Chinese to English . )
Stars: ✭ 834 (+365.92%)
Mutual labels:  youdao
web-translate
支持pdf和web的双击划词翻译脚本,当前使用爱词霸公共api
Stars: ✭ 43 (-75.98%)
Mutual labels:  youdao
Alfred Parrot
📝 一款可以多种语言翻译的 Alfred Workflow
Stars: ✭ 89 (-50.28%)
Mutual labels:  youdao
kictor
A dictionary based on the console, 一个基于控制台的词典工具
Stars: ✭ 15 (-91.62%)
Mutual labels:  youdao
Chrome Extension Udemy Translate
Translate Udemy's subtitles into Chinese、English etc(Disneyplus+netflix+udemy+lynda+hulu+hbo now+primevideo)
Stars: ✭ 553 (+208.94%)
Mutual labels:  youdao
Youdao Dictionary.el
Youdao Dictionary(有道词典) interface for Emacs
Stars: ✭ 151 (-15.64%)
Mutual labels:  youdao
Eazydict
简单易用的命令行词典 📕 📙 📗 📘 📓
Stars: ✭ 92 (-48.6%)
Mutual labels:  youdao
Whyliam.workflows.youdao
使用有道翻译你想知道的单词和语句
Stars: ✭ 837 (+367.6%)
Mutual labels:  youdao

youdao

简介

这是一个基于Python 在控制台下查单词的小工具。

这个小程序是受https://github.com/Flowerowl/ici 启发, 用requests 库和有道的API 重新实现的,后期加上了数据库、有道Web版、有道翻译、单词发音、Stardict 的支持。
从0.3.0开始添加了对Stardict 的支持(使用pystardict + C扩展加快查询速度)。默认情况下使用Stardict查询单词,如果没有找到则使用web版有道词典。
支持 单词发音(须要联网从有道获取,会缓存已经获取的mp3文件);支持 有道翻译,支持使用有道API查词;自动使用sqlite 数据库保存已经查询过的单词数据。

使用 Stardict

  1. 下载词典
    Stardict 是一个跨平台的国际词典软件,提供大量词库使用(可以去 http://pan.baidu.com/s/1dD1mIRJ 下载,推荐21世纪双语词典,当然也可以从网上找,但是不要下太多不然查询速度是个问题= =)
  2. 解压
    新建一个文件夹比如/home/chenlong/.dict_youdao/stardict,将下载的词典解压到该目录下(如下图)。
    词典解压目录
  3. 在程序中设置:
    使用命令 yd -s "/home/chenlong/.dict_youdao/stardict"
    成功后输出 stardict 路径设置成功: /home/chenlong/.dict_youdao/stardict
  4. 尽情使用stardict 吧
    使用 Stardict

使用有道词典

可能你不喜欢stardict(版权问题、颜色单一),那么可以按照上面的方法将stardict 的目录设置为空或者一个没有词典的空目录(一定是 空目录)。此时,程序将默认使用有道Web 版获取单词解释,对于没有解释的单词将自动使用有道翻译。
设置完成后使用yd keyword查词。
web版查询

单词发音

使用命令 yd -v keyword会在查询单词后获取单词发音,下载的单词发音保存在~/.dict_youdao/voice下,采用系统默认播放器播放。
在Linux 下推荐使用Clementine 播放器,播放时不会弹出新窗口。另外,查询单词后,使用yd -v 会自动获取上一个查询单词的发音。
单词发音

管理缓存单词

查询过的单词都使用sqlite 数据库保存,数据库文件在~/.dict_youdao
yd -l :列出数据库中的单词以及查询次数。
yd -c :清空数据库以及保存的发音。
yd -d keyword :删除某个单词

使用帮助

yd [-a] [-n] [-l] [-c] [-v] [-d word] [-y] [-s path] [--help] word
[-a] 使用API 而不是解析网页获取结果
[-n] 强制重新获取, 不管数据库中是否已经保存
[-l] 列出数据库中保存的所有单词
[-c] 清空数据库
[-v] 获取单词发音, 单独使用 yd -v 可以获取上一个查询单词的发音
[-d word] 删除数据库中某个单词
[-y] 优先使用有道词典
[-s path] 设置stardict词典路径
[--help] 显示帮助信息

安装

由于使用了C扩展,安装过程中需要vc 或gcc

Ubuntu(Linux):

sudo python setup.py install
或者
sudo pip install youdao

Windows:

由于Windows 下控制台下的编码问题,推荐使用cmder,并在cmder/vendor/init.bat 的最后加上

@chcp 65001 > nul
@set PYTHONIOENCODING=utf-8

更新历史

  • 0.3.6 upload to python3 and use pybind11 for the stardict lib
  • 0.3.1 bug fixed
  • 0.3.0 增加对stardict 的支持,使用pystardict,为加速查询编写了查询索引部分的C 扩展
  • 0.2.3 修复了使用api无法显示新单词结果的问题
  • 0.2.1 修复了无法显示已查询的单词的bug
  • 0.2.0 重新组织了代码结构以及数据库字段, 所以将丢失以前保存的单词
  • 0.1.5 添加获取单词发音的功能
  • 0.1.4 添加删除数据库中保存的单词的功能, 添加帮助说明
  • 0.1.3 抓取过的单词使用sqlite保存
  • 0.1.2 增加抓取web版有道词典页面的方法查词, 并默认使用这种方法. 可以通过 -a 选项使用api查词.
  • 0.1.1 改变查词方法为 yd keyword
  • 0.1.0 完成基本功能, 使用命令 youdao keyword 查词.

常见问题

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].