Objective

You will be building a Bash Script that will fetch all the bookmarks from all the major browsers (Google Chrome, Mozilla Firefox, Brave Browser and Chromium) and save them in a markdown file. It will also have the ability to filter out a word from the list of bookmarks.

Project Context

Managing bookmarks is a difficult task and if you use multiple browsers then remembering on which browser you bookmarked a URL is challenging. Even if you remember a keyword present in a URL you bookmarked, you have to go through each and every bookmark on every browser to find it.

In this project we will be building a Bash Script that will fetch all the bookmarks from all the major browsers (Google Chrome, Mozilla Firefox, Brave Browser and Chromium) on your system and filter only those that will contain a particular word which we can provide as an argument while running the script.

Project Stages

The project consists of the following stages:

sequence_diagram

High-Level Approach

  • Accessing arguments that were passed while running the script.
  • Fetching and filtering out bookmarks from Google Chrome, Chromium and Brave Browser by using text processing commands.
  • Fetching and filtering out bookmarks from Mozilla Firefox using appropriate SQLite query.
  • Appending all the bookmarks to a markdown file.

Objective

You will be building a Bash Script that will fetch all the bookmarks from all the major browsers (Google Chrome, Mozilla Firefox, Brave Browser and Chromium) and save them in a markdown file. It will also have the ability to filter out a word from the list of bookmarks.

Project Context

Managing bookmarks is a difficult task and if you use multiple browsers then remembering on which browser you bookmarked a URL is challenging. Even if you remember a keyword present in a URL you bookmarked, you have to go through each and every bookmark on every browser to find it.

In this project we will be building a Bash Script that will fetch all the bookmarks from all the major browsers (Google Chrome, Mozilla Firefox, Brave Browser and Chromium) on your system and filter only those that will contain a particular word which we can provide as an argument while running the script.

Project Stages

The project consists of the following stages:

sequence_diagram

High-Level Approach

  • Accessing arguments that were passed while running the script.
  • Fetching and filtering out bookmarks from Google Chrome, Chromium and Brave Browser by using text processing commands.
  • Fetching and filtering out bookmarks from Mozilla Firefox using appropriate SQLite query.
  • Appending all the bookmarks to a markdown file.

Accessing arguments passed to the script

Before we start doing all the complicated stuff of getting bookmarks from all the browsers, we need to access the arguments passed by the user while running the script.

Requirements

Expected Outcome

After completing the requirements, you would be able to access the argument passed by the user while running the script. This argument is utilized in later sections to filter out bookmarks.

Fetching bookmarks from Chromium Based Browsers

In this section we will fetch all the bookmarks saved in Google Chrome, Chromium and Brave Browser if they exists. After that we will narrow down the list of bookmarks obtained on the basis whether it contains the argument which we obtained in the previous section using the grep command.

Requirements

  • Check whether Google Chrome, Chromium or Brave Browser exists on that particular operating system.
  • Check whether there are any bookmarks or not.
  • If there are bookmarks then use text processing commands (such as grep, tr, cut) to filter out the URLs of the bookmarks.
  • Append the resultant list of bookmarks obtained from each browser in a markdown file using redirection.

Tip

  • You can check whether Google Chrome exists or not by looking for a folder named google-chrome in ~/.config folder.
  • Similarly you can check whether Chromium and Brave Browser exists or not.
  • All of the three browsers store bookmarks inside their respective folders in ~/.config folder.
  • The name of the file in which they store the bookmarks is Bookmarks which you have to find using the find command.
  • The format in which they store the bookmarks is also the same.

Bring it On!

  • Think of any other way of filtering out URLs of bookmarks. (HINT: You should look into jq command of bash).

Expected Outcome

After fulfilling all the requirements you would be able to grab all the bookmarks stored in Google Chrome, Chromium and Brave Browser and also filter out only those that contain the word provided by the user as an argument.

Fetching bookmarks from Mozilla Firefox

In this task we will fetch all the bookmarks saved in Mozilla Firefox if they exists. After that we will narrow down the list of bookmarks obtained on the basis of argument passed using the grep command and then append the resultant list of bookmarks to the markdown we created in the previous task using redirection.

Requirements

  • Check whether Mozilla Firefox exists in the system.
  • If it exists then check whether it has places.sqlite file.
  • If places.sqlite exists then fetch the URLs of bookmarks using appropriate SQLite query.
  • Filter the bookmarks on the basis whether it contains the argument which we obtained in task 1 using grep command.
  • Append the resultant list of bookmarks to the markdown file we created in previous task using redirection.

Note

  • moz_places and moz_bookmarks are the two important tables that you should spend time on in places.sqlite database

Bring it On!

  • Organize all the code that you've written so far into functions.

Expected Outcome

After fulfilling all the requirements you would be able to grab all the bookmarks stored in Mozilla Firefox also filter out only those that contains the word provided by the user as an argument. You can verify the same by viewing the markdown in which you appended the resultant list of bookmarks obtained after filtering.