{"id":13910421,"url":"https://github.com/shaarli/netscape-bookmark-parser","last_synced_at":"2025-07-18T09:31:24.855Z","repository":{"id":56734709,"uuid":"52473523","full_name":"shaarli/netscape-bookmark-parser","owner":"shaarli","description":"PHP library to parse Netscape bookmark files","archived":false,"fork":true,"pushed_at":"2023-08-25T15:24:58.000Z","size":227,"stargazers_count":24,"open_issues_count":4,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-10T20:47:37.759Z","etag":null,"topics":["bookmarks","chrome-bookmarks","firefox-bookmarks","netscape","netscape-bookmark","netscape-bookmark-file","parser"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/shaarli/netscape-bookmark-parser","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kafene/netscape-bookmark-parser","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaarli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-24T20:51:44.000Z","updated_at":"2025-05-25T10:13:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shaarli/netscape-bookmark-parser","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/shaarli/netscape-bookmark-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaarli%2Fnetscape-bookmark-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaarli%2Fnetscape-bookmark-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaarli%2Fnetscape-bookmark-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaarli%2Fnetscape-bookmark-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaarli","download_url":"https://codeload.github.com/shaarli/netscape-bookmark-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaarli%2Fnetscape-bookmark-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265733865,"owners_count":23819426,"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","chrome-bookmarks","firefox-bookmarks","netscape","netscape-bookmark","netscape-bookmark-file","parser"],"created_at":"2024-08-07T00:01:22.505Z","updated_at":"2025-07-18T09:31:24.497Z","avatar_url":"https://github.com/shaarli.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"[![GH release](https://img.shields.io/github/v/release/shaarli/netscape-bookmark-parser)](https://github.com/shaarli/netscape-bookmark-parser/releases)\n![GH license](https://img.shields.io/github/license/shaarli/netscape-bookmark-parser)\n![GH stars](https://img.shields.io/github/stars/shaarli/netscape-bookmark-parser)\n![Build Status](https://github.com/shaarli/netscape-bookmark-parser/workflows/PHP%20CI/badge.svg)\n\nShaarli Netscape Bookmark Parser\n================================\n\nThis library provides a decoder that is able of parsing Netscape bookmarks (as exported by common Web browsers and bookmarking services), and an encoder that is able to export data to bookmarks format.\n\n🚀 Installation\n---------------\n\nUsing [Composer](https://getcomposer.org/) ([package](https://packagist.org/packages/shaarli/netscape-bookmark-parser)):\n\n```bash\n$ composer require shaarli/netscape-bookmark-parser\n```\n\n🔥 Usage\n--------\n\n### Import from Bookmark file\n\n```php\n\u003c?php\n// parse.php\nrequire_once 'vendor/autoload.php';\n\nuse Shaarli\\NetscapeBookmarkParser\\NetscapeBookmarkParser;\n\n$parser = new NetscapeBookmarkParser();\n$bookmarks = $parser-\u003eparseFile('./tests/Fixtures/Encoder/input/netscape_basic.htm');\nvar_dump($bookmarks);\n```\n\nAbove example will return following array:\n\n```\narray(2) {\n  [0] =\u003e array(7) {\n    [\"name\"] =\u003e string(12) \"Secret stuff\"\n    [\"image\"] =\u003e NULL\n    [\"url\"] =\u003e string(19) \"https://private.tld\"\n    [\"tags\"] =\u003e array(2) {\n      [0] =\u003e string(7) \"private\"\n      [1] =\u003e string(6) \"secret\"\n    }\n    [\"description\"] =\u003e string(52) \"Super-secret stuff you're not supposed to know about\"\n    [\"dateCreated\"] =\u003e int(971175336)\n    [\"public\"] =\u003e bool(false)\n  }\n  [1] =\u003e array(7) {\n    [\"name\"] =\u003e string(12) \"Public stuff\"\n    [\"image\"] =\u003e NULL\n    [\"url\"] =\u003e string(17) \"http://public.tld\"\n    [\"tags\"] =\u003e array(3) {\n      [0] =\u003e string(6) \"public\"\n      [1] =\u003e string(5) \"hello\"\n      [2] =\u003e string(5) \"world\"\n    }\n    [\"description\"] =\u003e NULL\n    [\"dateCreated\"] =\u003e int(1456433748)\n    [\"public\"] =\u003e bool(true)\n  }\n}\n```\n\n### Export to file\n\n```php\n\u003c?php\n// export.php\nrequire_once 'vendor/autoload.php';\n\nuse Shaarli\\NetscapeBookmarkParser\\NetscapeBookmarkParser;\n\n$data = [\n    [\n        'name'        =\u003e 'shaarli/Shaarli',\n        'url'         =\u003e 'https://github.com/shaarli/Shaarli',\n        'image'       =\u003e 'data:image/png;base64, ...'\n        'description' =\u003e 'The personal, minimalist, super-fast, database free, bookmarking service',\n        'public'      =\u003e true,\n        'tags'        =\u003e ['shaarli'],\n    ],\n    [\n        'name'         =\u003e 'shaarli/netscape-bookmark-parser',\n        'url'          =\u003e 'https://github.com/shaarli/netscape-bookmark-parser',\n        'public'       =\u003e false,\n        'dateCreated'  =\u003e '1612572000',\n        'dateModified' =\u003e '1612572000',\n        'tags'         =\u003e ['shaarli'],\n    ],\n];\n\n$parser = new NetscapeBookmarkParser();\n\n$parser-\u003eexport($data, './export.htm');\n```\n\nAbove example will write following string into file:\n\n```xml\n\u003c!DOCTYPE NETSCAPE-Bookmark-file-1\u003e\n\u003cMETA HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\"\u003e\n\u003cTITLE\u003eBookmarks\u003c/TITLE\u003e\n\u003cH1\u003eBookmarks\u003c/H1\u003e\n\u003cDL\u003e\u003cp\u003e\n\u003cDT\u003e\u003cH3\u003eshaarli\u003c/H3\u003e\n\u003cDL\u003e\u003cp\u003e\n\u003cDT\u003e\u003cA HREF=\"https://github.com/shaarli/Shaarli\" PRIVATE=\"0\" ICON=\"data:image/png;base64, ...\"\u003eshaarli/Shaarli\u003c/A\u003e\n\u003cDD\u003eThe personal, minimalist, super-fast, database free, bookmarking service\n\u003cDT\u003e\u003cA HREF=\"https://github.com/shaarli/netscape-bookmark-parser\"\u003e ADD_DATE=\"1612572000\" LAST_MODIFIED=\"1612572000\"\u003eshaarli/netscape-bookmark-parser\u003c/A\u003e\n\u003c\\DL\u003e\u003cp\u003e\n\u003c\\DL\u003e\u003cp\u003e\n```\n\n💻 Dependencies\n---------------\n\n**Shaarli Netscape Bookmark Parser** requires the following dependencies:\n\n- PHP\n- Composer\n- Make (optional)\n\n---\n\n### 🐘 PHP\n\nLearn how to install PHP from official documentation [here](https://www.php.net/manual/en/install.php)\n\n---\n\n### 📦 Composer\n\nLearn how to install Composer from official documentation [here](https://getcomposer.org/download/)\n\n---\n\n### 🛠 Make\n\n#### 🐧 Install Make (Linux)\n\nOn linux machine enter following command\n\n```bash\n$ sudo apt-get install --assume-yes make\n```\n\n#### 🏁 Install Make (Windows)\n\nOn windows machine you will need to install [cygwin](http://www.cygwin.com/) or [GnuWin make](http://gnuwin32.sourceforge.net/packages/make.htm) first to execute make script.\n\n#### 🍎 Install Make (OSX)\n\nMake should be available by default on OSX system, but you can upgrade make version with following command\n\n```bash\n$ brew install make\n```\n\n---\n\n📑 About\n--------\n\n### ⚡ A word from Kafene\n\nThe motivations behind developing this parser are the following:\n- the [Netscape format](https://msdn.microsoft.com/en-us/library/aa753582%28v=vs.85%29.aspx) has a very loose specification: no [DTD](https://en.wikipedia.org/wiki/Document_type_definition) nor [XSL stylesheet](https://en.wikipedia.org/wiki/XSL) to constrain how data is formatted.\n- software and web services export bookmarks using a wild variety of attribute names and values.\n- using standard SAX or DOM parsers is thus not straightforward.\n\nHow it works:\n- the input bookmark file is trimmed and sanitized to improve parsing results\n- the resulting data is then parsed using [PCRE](http://www.pcre.org/) patterns to match attributes and values corresponding to the most likely:\n    - attribute names: `description` vs. `note`, `tags` vs. `labels`, `date` vs. `time`, etc.\n    - data formats: `comma,separated,tags` vs. `space separated labels`, UNIX epochs vs. human-readable dates, newlines \u0026 carriage returns, etc.\n- an associative array containing all successfully parsed links with their attributes is returned\n\n### ⚡ Shaarli community fork\n\nThis friendly fork is maintained by the Shaarli community at https://github.com/shaarli/netscape-bookmark-parser and is used by the open-source [Shaarli](https://github.com/shaarli/Shaarli) bookmarking service. This is a community fork of the original [netscape-bookmark-parser](https://github.com/kafene/netscape-bookmark-parser) project by [Kafene](http://kafene.org/).\n\n🤝 Contributing\n---------------\n\nThank you for your interrest in contributing to **Shaarli Netscape Bookmark Parser**.\n\nPlease review the [code of conduct](./CODE_OF_CONDUCT.md) and [contribution guidelines](./CONTRIBUTING.md) before starting to work on any features.\n\nIf you want to open an issue, please check first if it was not [reported already](https://github.com/shaarli/netscape-bookmark-parser/issues) before creating a new one.\n\n📜 License\n----------\n\nCopyrights (c) 2021 \u0026quot;Shaarli community\u0026quot;\n\n[![License](https://img.shields.io/badge/Licence-MIT-green.svg)](LICENSE)\nDistributed under the MIT license.\n\nIf you like **Shaarli Netscape Bookmark Parser** please star or tweet about it:\n\n[![GitHub stars](https://img.shields.io/github/stars/shaarli/netscape-bookmark-parser?style=social)](https://github.com/shaarli/netscape-bookmark-parser/stargazers)\n[![Twitter](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2Fshaarli%2Fnetscape-bookmark-parser)](https://twitter.com/intent/tweet?text=Wow:\u0026url=https%3A%2F%2Fgithub.com%2Fshaarli%2Fnetscape-bookmark-parser)\n\n🙏 Acknowledgements\n-------------------\n\n- [Shaarli Community](https://github.com/shaarli)\n- [Kafene](https://github.com/kafene)\n- [VirtualTam](https://github.com/virtualtam)\n- [TangoMan75](https://github.com/TangoMan75)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaarli%2Fnetscape-bookmark-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaarli%2Fnetscape-bookmark-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaarli%2Fnetscape-bookmark-parser/lists"}