比尔盖子 比尔盖子 - 1 month ago 16
HTML Question

Work with Netscape Bookmark File Format on Python?

My Chrome bookmark is too messy. So I export it, and decided to write a Python Program to clean my bookmark. For example: Sort them by the keyword.

I found Beautiful Soup. But the problem is, the export file is using Netscape Bookmark File Format, not standard XML. Beautiful Soup will try to convert them to standard XTML format. Chrome will unable to read it.

Is there another solution?

Answer

By default, Chrome stores your bookmarks as JSON, for example at:

C:\Users\user\AppData\Local\Google\Chrome\User Data\Default\Bookmarks

For Linux users:

~/.config/chrome/Default/Bookmarks

(The location of this file will vary depending on your platform of course.)

You might find this file easier to manipulate than an HTML export.

Comments