When Google EOLed Bookmarks feature, they allowed us to export them all into a single large HTML file. It is quite usable as it is, as you can open the file in a browser and search for keywords. However, I have been using Google Keep to organize my bookmarks by category and extracting the relevant bookmarks out of this large file is a pain mainly because the HTML file contains bookmarks by tag and so each bookmark tends to repeat several times as I used to give multiple tags for each.
This Python script is a quick attempt to extract entries without duplicates. It uses BeautifulSoup to identify all the entries with the specified keyword, write them to the console in a format suitable for copy pasting into Google Keep.
- Install dependencies:
pip install bs4 html5lib click
- Download and save the python script and view help
$ python GoogleBookmarks.py --help
Usage: GoogleBookmarks.py [OPTIONS]
Options:
-f, --file TEXT The path to the bookmarks file, e.g.,
GoogleBookmarks.html [required]
-k, --keyword TEXT The keyword to look for [required]
--help Show this message and exit.
- Run it
$ python GoogleBookmarks.py -f GoogleBookmarks.html -k android
Tested with the following versions:
- Python 3.10.12
- beautifulsoup4==4.12.2
- html5lib==1.1
- click==8.0.1