Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bkmk-0.0.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

bkmk-0.0.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file bkmk-0.0.1.tar.gz.

File metadata

  • Download URL: bkmk-0.0.1.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

Hashes for bkmk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 44584906d6ef6833c827aa695e3c1df1b3e06f13ed94eabb2f3466dc60ddd055
MD5 6f6e7a320053a271e24f725a8e19359e
BLAKE2b-256 4785d601d9148d36fa70ba6f3131110d3c52218299b1795e7529287bd1da4361

See more details on using hashes here.

File details

Details for the file bkmk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bkmk-0.0.1-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

Hashes for bkmk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84c0da60072f0b48d07bc222439c032f00593c0246515b6c128ac8322ada74cb
MD5 a363d85c579c3e33ba507ee32a4df68c
BLAKE2b-256 5efbfd1e14e15aba8ad474d571833a1d8c0c69400565b6b5cdf456f64b1e1786

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page