Install
$ pip install zbookmarks
Usage
A simple python package for loading / dumping Chrome HTML bookmarks. Born out of necessity to fix my own bookmarks.
import zbookmarks
# Load
with open("chrome_bookmarks.html", "r") as f:
bookmarks = zbookmarks.load_chrome(f.read())
# Print
print(bookmarks)
# Dump
with open("output.html", "w") as f:
zbookmarks.dump_chrome(bookmarks, f)
How it works
I made this package by examining my own Chrome bookmark files and extrapolating. The general rules are:
dldenotes a list of bookmark items and folders.dtdenotes either a bookmark item or folder:- If it's a bookmark item,
dthas a singleatag child, which gives the bookmark attributes (href, title, etc.). - If it's a bookmark folder,
dthas 3 children:- A
h3tag containing the folder attributes (title, etc.) - A
dltag containing the folder's contents. - A useless
pchild tag.
- A
- If it's a bookmark item,
I found it easier to come up with these rules after visualizing the DOM tree of a Chrome bookmarks file:
You can try it out on your own bookmark file by running:
# You need to install graphviz (dot) in order to run the script
$ sudo apt-get install -y graphviz
$ poetry install
$ python3 scripts/visualize_dom.py <my_bookmarks_file.html>
Metadata
Release files for zbookmarks 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zbookmarks-1.3.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zbookmarks-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / zbookmarks-1.3.tar.gz
| Download URL | zbookmarks-1.3.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed7137be7c26f71c9bb514a9ef97ecc39ae3561b9d3ce8795d70353b651e5521
|
|
BLAKE2b-256 checksum How to use checksums |
7305faebc672fc8e0503e8a73e7021629b25bc12c2cd75d9102738da263ec1fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.5 Linux/4.19.128-microsoft-standard
|
Release files / zbookmarks-1.3-py3-none-any.whl
| Download URL | zbookmarks-1.3-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b16decb4b4c44201d5d89e21135850ddd468aa5642679ff1c6c9fa5984f9ccc
|
|
BLAKE2b-256 checksum How to use checksums |
5a6843eb26b9b72e7eccd724a66007c96e7251f0245038a2c953877d0bd5c7b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.5 Linux/4.19.128-microsoft-standard
|