marxbook/misc/buku_import.py
2021-03-21 12:09:07 +01:00

13 lines
502 B
Python
Executable file

from pathlib import Path
import sqlite3
def import_from_buku(store, buku_path: Path = None):
if buku_path is None:
buku_path = Path('~/.local/share/buku/bookmarks.db').expanduser()
conn = sqlite3.connect(buku_path)
cur = conn.cursor()
query = '''SELECT URL, metadata, tags, desc FROM bookmarks'''
for url, title, tags, desc in cur.execute(query):
tags = [t.strip() for t in tags.split(',')]
store.add('', url=url, title=title, tags=tags, description=desc)