Skip to main content

Parse db/html/json bookmarks file from (Chrome - Firefox - Custom source) and convert it to db/html/json format.

Project description

Bookmarks_Converter


image image image

Bookmarks Converter is a package that converts the webpage bookmarks from DataBase/HTML/JSON to DataBase/HTML/JSON.

  • The Database files supported are custom sqlite database files created by the SQLAlchemy ORM model found in the .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 or the bookmarks_file_structure.md.


Python and OS Support

The package has been tested on Github Actions with the following OSs and Python versions:

OS \ Python 3.9 3.8 3.7 3.6
macos-latest :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
ubuntu-latest :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
windows-latest :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:

Dependencies

The package relies on the following libraries:


Install

Bookmarks Converter is available on PYPI

python -m pip install bookmarks-converter

Test

To test the package you will need to clone the git repository.

# 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.

# navigate to repo's folder
cd bookmarks_converter
# install the dependencies
poetry install
# run the tests
poetry run pytest

Usage

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()

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bookmarks-converter-0.1.0.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

bookmarks_converter-0.1.0-py3-none-any.whl (11.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page