Universal bookmark file format utility
Project description
bkmk
bkmk
is a Python library and command-line utility to convert between
different bookmarks formats.
It has been tested thoroughly on the following formats, and supports conversion between any of them:
- XBEL - a standardised and precisely-defined XML-based format
- Netscape HTML - an imprecisely-defined ad-hoc external interchange format supported by most browsers including Firefox and Chrome, as well as being used internally by Firefox and Mozilla-based browsers
- Chrome JSON - an undocumented format, used internally by Chrome
We also have our own "bkmk
JSON" format which expresses a superset of all the
features of all the above formats. The format is extremely simple and will
remain stable across many versions of this tool. Files written in this format
can easily be manipulated using common ecosystem tools such as jq(1)
.
The Python library also offers a simple API:
from bkmk import *
input_filenames = "a.xbel b.xbel".split()
output_filestem = "combined"
output_exts = ".json .html".split()
# combine several bookmark files into one
bk = Bookmarks.new()
for fn in input_filenames:
with open(fn) as fp:
bm = Bookmarks.read(fp, "xbel").root
bm.name = fn
bk.root.children.append(bm)
# fill in special top-level folders that browsers sometimes expect/require when importing
bk.fill_special()
# fill in timestamps for completeness
bk.fill_timestamps()
# output in several different formats
for o in output_exts:
with open("%s%s" % (output_filestem, o), "w") as fp:
bk.write(fp, FORMAT_EXTS[o][0], cull_special=True)
All the functionality of the CLI is mirrored in the API; see --help
or
pydoc
for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bkmk-0.0.2.tar.gz
.
File metadata
- Download URL: bkmk-0.0.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3e78526e8df7c35e0fb8ffe582a09bd32e65045ca4ff67988fa28e1e1a753ba |
|
MD5 | 5f32834940a3c3cf7d01e1f300e64402 |
|
BLAKE2b-256 | 925ae7fd43afc681bf6e8dd15f15ceb40dc273e6d26e63d205fd26168adcf677 |
File details
Details for the file bkmk-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: bkmk-0.0.2-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eae12a82188e87775a51917a68a9991cb8f83243d6b118983a5138dd5e9f9d1 |
|
MD5 | 1c8d4158a16a685c4a15f0ab9db9cd6a |
|
BLAKE2b-256 | a734bec89d55d6e7472472fbd540d47b19bc13d257e7270053c35e3a1b65f1de |