dlhn是一个python cli脚本,用于从hacker news api下载我的评论和提交,并使用jinja2模板生成一个静态html存档
dlhn的Python项目详细描述
dlhn
dlhn是一个python cli脚本,用于下载我的评论和提交 来自Hacker News API 并使用jinja2模板生成一个静态html归档文件
功能
- 从Hacker News API下载评论和提交内容
- 将注释树和提交文件归档为json
- 将注释树和提交文件存档为静态HTML 使用Jinja2 HTML模板
- 积极地缓存无法更改的条目 具有两层缓存系统,包括请求缓存 以及sqlite数据库
安装
使用pip安装dlhn:
pip install dlhn
# pip install -e git+https://github.com/westurner/dlhn#egg=dlhn
使用量
致电dlhn:
dlhn -u dlhntestuser -o index.html --expire-newerthan 14d
或者,为github页面创建一个repo并添加一个Makefile:
# hnlog Makefile USERNAME:=dlhntestuser default:backupinstall: pip install -e git+https://github.com/westurner/dlhn#egg=dlhn backup: @# items with a cachetime newer than 14d ago may need to be pulled again @# because they may not be locked yet (cachetime != item_time) dlhn -u '$(USERNAME)' -o index.html --expire-newerthan 14d backup-nocache: dlhn -u '$(USERNAME)' -o index.html commit: git add ./index.html ./index.html.json ./dlhn.sqlite &&\ git commit -m ":books: Updated index.html, index.html.json, and dlhn.sqlite"push: git push all:backupcommitpush
并在调用make:
make all USERNAME=dlhntestuser
参考文献
许可证
BSD许可证
DLHN存档公开的评论和提交 来自Hacker News API 对于非商业用途,使用“ctrl-f”可以轻松搜索一页。
历史记录
0.2.5(2019-04-17)
- 更新readme.rst
0.2.4(2019-04-17)
- 使用pip包名称更新文档
- 更新history.rst
0.2.3(2019-04-17)
- 添加setup.py
- 添加一些测试
- pypi上的第一个版本。
0.1.0(2017-11-28)
- 简单的python脚本