用于搜索youtube标题的cli工具
ytgrep的Python项目详细描述
ytgrep是一个cli工具,用于搜索带有类似grep界面的youtube闭路字幕。
要求
- 需要python>;=3.5
安装
pip install ytgrep
注意:pip的bin文件夹必须位于路径中。
用法
usage: ytgrep.py [-h][-e][-v][-links] pattern urls [urls ...]
标志
- -e<;pattern>;-指定要匹配的正则表达式
- -v-详细,打印调试信息
- -链接-在每个匹配项中包含时间快捷链接(请参见下面的示例)
更多示例
包括带时间戳的链接(例如<;youtube url&g t;/&;t=196s),以便直接跳转到视频中提到关键字的部分。
$ ytgrep -links 'potassium' https://www.youtube.com/watch?v=OIYOshsEqmQ
使用正则表达式搜索
ytgrep -e 'banana|potassium' https://www.youtube.com/watch?v=OIYOshsEqmQ
搜索多个URL
ytgrep 'banana' https://www.youtube.com/watch?v=LH5ay10RTGY https://www.youtube.com/watch?v=zFQWVN4xip0
开发
运行测试
注意:功能测试确实可以直接从youtube下载
## All tests python -m unittest discover ## Unit tests python -m unittest discover test/unit ## Functional tests python -m unittest discover test/functional