Bookmark Toolkit (btk) is a command-line tool for managing and analyzing bookmarks. It provides features for importing, searching, editing, and exporting bookmarks, as well as querying them using JMESPath.
To install bookmark-tk
, you can use pip
:
pip install bookmark-tk
It installs a command-line took, btk
. To see how to use it, type:
btk --help
-
import: Import bookmarks from various formats, e.g., Netscape Bookmark Format HTML file.
btk import oldbookmarks --format netscape --output bookmarks
-
search: Search bookmarks by query.
btk search mybookmarks "statistics"
-
list-index: List the bookmarks with the given indices.
btk list-index mybookmarks 1 2 3
-
add: Add a new bookmark.
btk add mybookmarks --title "My Bookmark" --url "https://example.com"
-
edit: Edit a bookmark by its ID.
btk edit mybookmarks 1 --title "Updated Title"
-
remove: Remove a bookmark by its ID.
btk remove mybookmarks 2
-
list: List all bookmarks (including metadata).
btk list mybookmarks
-
visit: Visit a bookmark by its ID.
btk visit mybookmarks 103
-
merge: Perform merge (set) operations on bookmark libraries.
btk merge union lib1 lib2 lib3 --output merged
-
cloud: Generate a URL mention graph from bookmarks.
btk cloud mybookmarks --output graph.png
-
reachable: Check and mark bookmarks as reachable or not.
btk reachable mybookmarks
-
purge: Remove bookmarks marked as not reachable.
btk purge mybookmarks --output purged
-
export: Export bookmarks to a different format.
btk export mybookmarks --output bookmarks.csv
-
jmespath: Query bookmarks using JMESPath.
btk jmespath mybookmarks "[?visit_count > `0`].title"
-
stats: Get statistics about bookmarks.
btk stats mybookmarks
-
about: Get information about the tool.
btk about
-
version: Get the version of the tool.
btk version
-
llm: Use a large language model (LLM) to automatically generate appropriate queries from natural language prompts.
btk llm mybookmarks "Find bookmarks that are starred and have a visit count greater than 0."
Or, more complex:
btk llm bookmarks "search for bookmarks with chatgpt in the title and has been visited at least once or it also has awesome in the title in addition to chatgpt. or, finally, it was added after 2022"
- Get all starred bookmarks:
btk jmespath mybookmarks "[?stars == `true`].title"
- Get URLs of frequently visited bookmarks:
btk jmespath mybookmarks "[?visit_count > `5`].url"
- Get bookmarks that contain 'wikipedia' in the URL:
btk jmespath mybookmarks "[?contains(url, 'wikipedia')].{title: title, url: url}"
This project is licensed under the MIT License.
Contributions are welcome! Please submit a pull request or open an issue if you have suggestions or improvements.
Developed by Alex Towell.