# Bookmarks Converter
---
[![image](https://img.shields.io/github/workflow/status/radam9/bookmarks-converter/build-deploy/main?style=flat-square)](https://github.com/radam9/bookmarks-converter)
[![image](https://img.shields.io/github/license/radam9/bookmarks-converter?style=flat-square)](https://pypi.org/project/bookmarks-converter/)
[![image](https://img.shields.io/pypi/pyversions/bookmarks-converter?style=flat-square)](https://pypi.org/project/bookmarks-converter/)
Bookmarks Converter is a package that converts the webpage bookmarks
from `DataBase`/`HTML`/`JSON` to `DataBase`/`HTML`/`JSON`. It can be used as a `module` or using the [CLI](#usage-as-cli).
- The Database files supported are custom sqlite database files created by the SQLAlchemy ORM model found in the [`.models.py`](/src/bookmarks_converter/models.py).
- The HTML files supported are Netscape-Bookmark files from either Chrome or Firefox. The output HTML files adhere to the firefox format.
- The JSON files supported are the Chrome `.json` bookmarks file, the Firefox `.json` bookmarks export file, and the custom json file created by this package.
To see example of the structure or layout of the `DataBase`, `HTML` or `JSON` versions supported by the packege, you can check the corresponding file in the data folder found in the [github page data](data/) or the [bookmarks_file_structure.md](bookmarks_file_structure.md).
---
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Python and OS Support](#python-and-os-support)
- [Dependencies](#dependencies)
- [Install](#install)
- [Test](#test)
- [Usage as Module](#usage-as-module)
- [Usage as CLI](#usage-as-cli)
- [License](#license)
---
### Python and OS Support
The package has been tested on Github Actions with the following OSs and Python versions:
| OS \ Python | `3.12` | `3.11` | `3.10` | `3.9` |
| :--------------- |:-------:|:-------:|:-------:|:-------:|
| `macos-latest` | ✓ | ✓ | ✓ | ✓ |
| `ubuntu-latest` | ✓ | ✓ | ✓ | ✓ |
| `windows-latest` | ✓ | ✓ | ✓ | ✓ |
---
### Dependencies
The package relies on the following libraries:
- [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup/): used to parse the HTML files.
- [SQLAlchemy](https://www.sqlalchemy.org/): used to create and manager the database files.
---
### Install
Bookmarks Converter is available on [PYPI](https://pypi.org/project/bookmarks-converter/)
```bash
python -m pip install bookmarks-converter
```
---
### Test
To test the package you will need to clone the [git repository](https://github.com/radam9/bookmarks-converter).
```bash
# Cloning with HTTPS
git clone https://github.com/radam9/bookmarks-converter.git
# Cloning with SSH
git clone git@github.com:radam9/bookmarks-converter.git
```
then you create and install the dependencies using [`Poetry`](https://python-poetry.org/).
```bash
# navigate to repo's folder
cd bookmarks-converter
# install the dependencies
poetry install
# run the tests
poetry run pytest
```
---
### Usage as Module
```python
from bookmarks_converter import BookmarksConverter
# initialize the class passing in the path to the bookmarks file to convert
bookmarks = BookmarksConverter("/path/to/bookmarks_file")
# parse the file passing the format of the source file; "db", "html" or "json"
bookmarks.parse("html")
# convert the bookmarks to the desired format by passing the fomrat as a string; "db", "html", or "json"
bookmarks.convert("json")
# at this point the converted bookmarks are stored in the 'bookmarks' attribute.
# which can be used directly or exported to a file.
bookmarks.save()
```
---
### Usage as CLI
```python
# Activate the virtual environment if the "bookmarks-converter" package was installed inside one.
# run bookmarks-converter with the desired settings
# bookmarks-converter input_format output_format filepath
bookmarks-converter db json /path/to/file.db
# use -h for to show the help message (shown in the code block below)
bookmarks-converter -h
```
The help message:
```bash
usage: bookmarks-converter [-h] [-V] input_format output_format filepath
Convert your browser bookmarks file from (db, html, json) to (db, html, json).
positional arguments:
input_format Format of the input bookmarks file. one of (db, html, json).
output_format Format of the output bookmarks file. one of (db, html, json).
filepath Path to bookmarks file to convert.
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
```
---
### License
[MIT License](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/radam9/bookmarks-converter",
"name": "bookmarks-converter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "bookmarks,bookmarks converter,bookmarks-converter,bookmarks-parser,bookmarks parser",
"author": "Adam Saleh",
"author_email": "radam9@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/24/ff/6c609bdcb56e01db6e74c3d4cc3da22c6673dd1406603ba5b86b0f40fde2/bookmarks_converter-0.3.4.tar.gz",
"platform": null,
"description": "# Bookmarks Converter\n\n---\n[![image](https://img.shields.io/github/workflow/status/radam9/bookmarks-converter/build-deploy/main?style=flat-square)](https://github.com/radam9/bookmarks-converter)\n[![image](https://img.shields.io/github/license/radam9/bookmarks-converter?style=flat-square)](https://pypi.org/project/bookmarks-converter/)\n[![image](https://img.shields.io/pypi/pyversions/bookmarks-converter?style=flat-square)](https://pypi.org/project/bookmarks-converter/)\n\n\nBookmarks Converter is a package that converts the webpage bookmarks\nfrom `DataBase`/`HTML`/`JSON` to `DataBase`/`HTML`/`JSON`. It can be used as a `module` or using the [CLI](#usage-as-cli).\n\n- The Database files supported are custom sqlite database files created by the SQLAlchemy ORM model found in the [`.models.py`](/src/bookmarks_converter/models.py).\n\n- The HTML files supported are Netscape-Bookmark files from either Chrome or Firefox. The output HTML files adhere to the firefox format.\n\n- The JSON files supported are the Chrome `.json` bookmarks file, the Firefox `.json` bookmarks export file, and the custom json file created by this package.\n\nTo see example of the structure or layout of the `DataBase`, `HTML` or `JSON` versions supported by the packege, you can check the corresponding file in the data folder found in the [github page data](data/) or the [bookmarks_file_structure.md](bookmarks_file_structure.md).\n\n---\n## Table of Contents\n - [Table of Contents](#table-of-contents)\n - [Python and OS Support](#python-and-os-support)\n - [Dependencies](#dependencies)\n - [Install](#install)\n - [Test](#test)\n - [Usage as Module](#usage-as-module)\n - [Usage as CLI](#usage-as-cli)\n - [License](#license)\n---\n### Python and OS Support\nThe package has been tested on Github Actions with the following OSs and Python versions:\n\n| OS \\ Python | `3.12` | `3.11` | `3.10` | `3.9` |\n| :--------------- |:-------:|:-------:|:-------:|:-------:|\n| `macos-latest` | ✓ | ✓ | ✓ | ✓ |\n| `ubuntu-latest` | ✓ | ✓ | ✓ | ✓ |\n| `windows-latest` | ✓ | ✓ | ✓ | ✓ |\n\n\n---\n### Dependencies\nThe package relies on the following libraries:\n- [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup/): used to parse the HTML files.\n- [SQLAlchemy](https://www.sqlalchemy.org/): used to create and manager the database files.\n\n---\n### Install\nBookmarks Converter is available on [PYPI](https://pypi.org/project/bookmarks-converter/)\n```bash\npython -m pip install bookmarks-converter\n```\n\n---\n### Test\nTo test the package you will need to clone the [git repository](https://github.com/radam9/bookmarks-converter).\n\n```bash\n# Cloning with HTTPS\ngit clone https://github.com/radam9/bookmarks-converter.git\n\n# Cloning with SSH\ngit clone git@github.com:radam9/bookmarks-converter.git\n```\nthen you create and install the dependencies using [`Poetry`](https://python-poetry.org/).\n\n```bash\n# navigate to repo's folder\ncd bookmarks-converter\n# install the dependencies\npoetry install\n# run the tests\npoetry run pytest\n```\n\n---\n### Usage as Module\n```python\nfrom bookmarks_converter import BookmarksConverter\n\n# initialize the class passing in the path to the bookmarks file to convert\nbookmarks = BookmarksConverter(\"/path/to/bookmarks_file\")\n\n# parse the file passing the format of the source file; \"db\", \"html\" or \"json\"\nbookmarks.parse(\"html\")\n\n# convert the bookmarks to the desired format by passing the fomrat as a string; \"db\", \"html\", or \"json\"\nbookmarks.convert(\"json\")\n\n# at this point the converted bookmarks are stored in the 'bookmarks' attribute.\n# which can be used directly or exported to a file.\nbookmarks.save()\n```\n\n---\n### Usage as CLI\n```python\n# Activate the virtual environment if the \"bookmarks-converter\" package was installed inside one.\n\n# run bookmarks-converter with the desired settings\n\n# bookmarks-converter input_format output_format filepath\nbookmarks-converter db json /path/to/file.db\n\n# use -h for to show the help message (shown in the code block below)\nbookmarks-converter -h\n```\nThe help message:\n```bash\nusage: bookmarks-converter [-h] [-V] input_format output_format filepath\n\nConvert your browser bookmarks file from (db, html, json) to (db, html, json).\n\npositional arguments:\n input_format Format of the input bookmarks file. one of (db, html, json).\n output_format Format of the output bookmarks file. one of (db, html, json).\n filepath Path to bookmarks file to convert.\n\noptional arguments:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n```\n\n---\n### License\n[MIT License](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Parse db/html/json bookmarks file from (Chrome - Firefox - Custom source) and convert it to db/html/json format.",
"version": "0.3.4",
"project_urls": {
"Homepage": "https://github.com/radam9/bookmarks-converter",
"Repository": "https://github.com/radam9/bookmarks-converter"
},
"split_keywords": [
"bookmarks",
"bookmarks converter",
"bookmarks-converter",
"bookmarks-parser",
"bookmarks parser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d06f7753b34138331b0ecfc7e3084558cc2b12b0168fcb51d6ef31f539c0204a",
"md5": "fb08bd74a6cbce7929e8116ab8f01941",
"sha256": "030c6b185786c5a6ee09342464251f5993985c1aa32ea459ad055d30d6de3b23"
},
"downloads": -1,
"filename": "bookmarks_converter-0.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb08bd74a6cbce7929e8116ab8f01941",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 14012,
"upload_time": "2023-10-13T13:47:58",
"upload_time_iso_8601": "2023-10-13T13:47:58.096631Z",
"url": "https://files.pythonhosted.org/packages/d0/6f/7753b34138331b0ecfc7e3084558cc2b12b0168fcb51d6ef31f539c0204a/bookmarks_converter-0.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "24ff6c609bdcb56e01db6e74c3d4cc3da22c6673dd1406603ba5b86b0f40fde2",
"md5": "47d0f4e2d52b3d351c7cad0945e15702",
"sha256": "2f228eb88915b693b9fd2d43b89f9b63d3eaef901a1470e17bccb4fb48fb27af"
},
"downloads": -1,
"filename": "bookmarks_converter-0.3.4.tar.gz",
"has_sig": false,
"md5_digest": "47d0f4e2d52b3d351c7cad0945e15702",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 13423,
"upload_time": "2023-10-13T13:47:59",
"upload_time_iso_8601": "2023-10-13T13:47:59.243057Z",
"url": "https://files.pythonhosted.org/packages/24/ff/6c609bdcb56e01db6e74c3d4cc3da22c6673dd1406603ba5b86b0f40fde2/bookmarks_converter-0.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-13 13:47:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "radam9",
"github_project": "bookmarks-converter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bookmarks-converter"
}