{"id":13910674,"url":"https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser","last_synced_at":"2025-07-18T09:32:28.457Z","repository":{"id":48339394,"uuid":"261228137","full_name":"FlyingWolFox/Netscape-Bookmarks-File-Parser","owner":"FlyingWolFox","description":"Parser and creator for Netscape Bookmarks file format that is used when exporting bookmarks from browsers","archived":false,"fork":false,"pushed_at":"2024-02-14T23:09:02.000Z","size":110,"stargazers_count":40,"open_issues_count":4,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-08T00:43:54.916Z","etag":null,"topics":["bookmarks","browser","create","exporting-bookmarks","generate","netscape","netscape-bookmark","netscape-bookmark-file","parse-bookmarks","parse-netscape","parse-netscape-bookmarks-file","parse-netscape-bookmarks-file-1","parser"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlyingWolFox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-04T15:48:14.000Z","updated_at":"2024-07-28T14:53:01.000Z","dependencies_parsed_at":"2022-09-18T10:42:46.868Z","dependency_job_id":null,"html_url":"https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlyingWolFox%2FNetscape-Bookmarks-File-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlyingWolFox%2FNetscape-Bookmarks-File-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlyingWolFox%2FNetscape-Bookmarks-File-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlyingWolFox%2FNetscape-Bookmarks-File-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlyingWolFox","download_url":"https://codeload.github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226388700,"owners_count":17617320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bookmarks","browser","create","exporting-bookmarks","generate","netscape","netscape-bookmark","netscape-bookmark-file","parse-bookmarks","parse-netscape","parse-netscape-bookmarks-file","parse-netscape-bookmarks-file-1","parser"],"created_at":"2024-08-07T00:01:41.460Z","updated_at":"2024-11-25T19:31:38.713Z","avatar_url":"https://github.com/FlyingWolFox.png","language":"Python","readme":"# Netscape Bookmarks File Parser\n\nThis is a parser for the Netscape Bookmarks file format, which is generated by browsers when exporting bookmarks to html. It parses the file and delivers an object representing the file with the bookmark structure of folders and shortcuts as objects too. The folder tree can be navigated using the \".\" notation. It an also create a Netscape Bookmarks file.\n\n## Installation\n\nRun this in your command line (might need to run as administrator on Windows):\n\n```bash\npip install git+https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser.git\n```\n\nTo update add the `--upgrade` flag to the end\n\n## How to use\n\nImport the classes and the parser:\n\n```python\nfrom NetscapeBookmarksFileParser import *\nfrom NetscapeBookmarksFileParser import parser   # if you want to parse a file\n```\n\nIf you want to create a file, import the creator as well:\n\n```python\nfrom NetscapeBookmarksFileParser import creator  # if you want to create a file\n```\n\nthen:\n\n```python\nbookmarks = NetscapeBookmarksFile(file).parse()\n```\n\nWhere `file` is a string with the file contents or a file opened with `open()`, e.g.:\n\n```python\nwith open('bookmarks.html') as file:\n    bookmarks = NetscapeBookmarksFile(file)\n```\n\nor:\n\n```python\nwith open('bookmarks.html') as file:\n    bookmarks = NetscapeBookmarksFile(file.read())\n```\n\nIf you want to create a file, create the bookmark structure and call `create_file()`.\n\nTo know about the classes that the parser and the creator will work with, see the [wiki Classes section](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/Code-Documentation#classes).\n\n## Quick Example\n\n```python\nfrom NetscapeBookmarksFileParser import *\nfrom NetscapeBookmarksFileParser import parser\n\nwith open('bookmarks.html') as file:\n    bookmarks = NetscapeBookmarksFile(file).parse()\n\nroot_folder = bookmarks.bookmarks\nprint(bookmarks.title)                           # print the file's title\nprint(root_folder.items[0].name)                 # print the name of the first item on the root folder\nprint(root_folder.shortcuts[1].href)             # print the url of the first shortcut on the root folder\nprint(root_folder.children[0].personal_toolbar)  # print if the first children folder is the Bookmarks Toolbar\n```\n\n## Notice about this parser\n\nThe parser will play like a browser and will ignore most errors and warn for some missing tags. If a folder has an opening `\u003cbody\u003e`, but no closing `\u003c/body\u003e`, an exception will be raised. Since Netscape Bookmarks files are commonly generated by browsers when exporting bookmarks in html, these warnings and exceptions shouldn't be common. This parser was based on [Microsoft's documentation on the Netscape File Format](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa753582(v=vs.85)?redirectedfrom=MSDN) mainly, but also on file examples ([here](https://sixtwothree.org/posts/homesteading-a-decades-worth-of-shared-links), [here](https://stackoverflow.com/questions/38029954/parse-a-netscape-style-bookmarks-html-file-into-nested-array), [here](https://gist.github.com/jgarber623/cdc8e2fa1cbcb6889872) and [here](https://www.npmjs.com/package/netscape-bookmarks)) and my own browser exports (`test\\test.html` is one of them). Some more uncommon attributes and items might not be supported. See the [Attributes Supported](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/The-Parser#attributes-supported) and [Items Supported](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/The-Parser#items-supported) sections in the wiki. If you want to know more about what a file needs to have to be accepted by the parser, read the [Netscape Bookmarks File Format page](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/Netscape-Bookmarks-File-Format) in the wiki.\n\n## Notice about the creator\n\nThe creator is the parser in reverse. If you parse a file and create it again, if all lines are valid, the files will be equal. You can see this with `test/test.html` and `test/created_file.html`. The first was parsed, then the creation process created the second. Look at the [wiki Creator page]() to know more about the creator.\n\n## About legacy support\n\nDue to the Netscape Bookmark file format not having an official standard, many things of this parser was got by file examples in the internet (see the [Nestcape Bookmarks File format](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/Netscape-Bookmarks-File-Format) and [The parser](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/The-Parser) in the wiki). This has legacy support for some types of items that aren't in use today. These are:\n\n- Feed: Probably RSS feeds, just some attributes following the Microsoft's Documentation\n- Web Slices: \"Live bookmarks\". They showed a piece of the page you saved. Extinct but in the Microsoft's Documentation. If you want more details look at the [Legacy section](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki/The-Parser#about-legacybasic-support) in the wiki\n\n## Help\n\n- If you would like to report a bug or ask a question please [open an issue](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/issues/new).\n- If you would like to help this project, you can open a Pull Request\n- If you want more information about this project, have a look at the [wiki](https://github.com/FlyingWolFox/Netscape-Bookmarks-File-Parser/wiki)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlyingWolFox%2FNetscape-Bookmarks-File-Parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFlyingWolFox%2FNetscape-Bookmarks-File-Parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlyingWolFox%2FNetscape-Bookmarks-File-Parser/lists"}