提取kindle笔记

首先在Kindle上通过邮件把笔记分享到自己的邮箱,然后把html下载到本地,执行下面的脚本:

#!/usr/bin/env python
import os
import sys

from lxml import html


def extract_notes(s):
    etree = html.fromstring(s)

    for i in etree.find_class("noteText"):
        yield i.text


if __name__ == "__main__":
    notes = []

    with open(sys.argv[1]) as f:
        s = f.read()
        for i in extract_notes(s):
            notes.append(i)

    print("".join(notes))

执行之后,就会输出提取之后的文档。

$ python kindle.py 读书笔记.html

2019.11.12注:

网页版已经移除,请使用脚本。先安装Python3,然后pip安装lxml,之后即可执行此脚本。


更多文章
  • Go设计模式:facade模式和观察者模式
  • Go设计模式: 责任链模式
  • 我们真的需要这么复杂的技术栈吗?
  • Go设计模式:装饰器模式
  • 程序员的MySQL手册(一): 安装,基本配置
  • ElasticSearch学习笔记
  • Go设计模式:composite模式
  • 拯救删除ZFS之后的分区表
  • Linux使用redshift自动调整屏幕色温
  • Go设计模式:桥接模式和策略模式
  • Go设计模式:单例模式、原型模式和Builder模式
  • 操作系统也是CRUD
  • Go设计模式:简单工厂模式
  • 把USB设备穿透给虚拟机里的系统
  • debug故事之:事务让生活更美好