Create a Chrome bookmark html file to import list of URLs

I recently switched RSS providers and I could only extract my saved posts as a list of URLs. So I thought I’d add these to a bookmark folder in Chrome. However, Chrome bookmark import only accepts a specifically formatted .html file.

So if you have a file with all your urls, name this file ‘url.txt’ and run this script to create a .html file that you can import in Chrome (hat-tip to GeoffreyPlitt).

#!/bin/bash
#
# Run this script on a file named urls.txt with all your URLs and pipe the output to an HTML file.
# Example: ./convert_url_file.sh > bookmarks.html

echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
  cat urls.txt |
  while read L; do
    echo -n '    <DT><A HREF="';
        echo ''"$L"'">'"$L"'</A>';
  done
echo "</DL><p>"

Comments

14 responses to “Create a Chrome bookmark html file to import list of URLs”

  1. Aaron Atkins Avatar

    I have created a free online tool to automate this process. Check it out here:

    https://atkinsio.com/bookmarks-html-generator/

    The GitHub is open source if you would like to make something similar yourself.

    1. Kev Avatar
      Kev

      Can’t thank you enough! I’ve been searching for this kind of tool for months. Works exactly as I wanted. Thanks man

    2.  Avatar
      Anonymous

      Thanks a lot!

    3. Andrew Avatar
      Andrew

      Brilliant: there’s no information online about how to format a Bookmarks file and I was tearing my hair out trying every naming combination etc. I have to Export, edit and import long bibliographies with links attached and this will make it very easy. Many thanks

    4. Mari Avatar

      thank you for existing, sir! thank you! thank you!

  2. Becky Avatar
    Becky

    I am really thankfull to you Jan van den Berg and Aaron Atkins. Now I can easily export lots of Youtube URLs to raindrop and see if some video was deleted

  3. Michele Avatar
    Michele

    Thank you! Is there a way to specify the bookmark folder path for each url?

    1. Jan van den Berg Avatar

      You would need an identifier / name, the script can’t guess this for you :).

      Because you only have a list of URLs you could have a folder path based on domains. But I am not sure how useful this would be (how many URLs from the same domain have you got bookmarked?)

      Another way would be to add a second ‘column’ in your URL list where you specify the desired folder path. And rebuild the script to use this column as as folder path.

  4. Jen Hilburn Avatar
    Jen Hilburn

    Thank you so much for this! Question: Is there a way to also import tab names? For example, if I wanted to put a student name on each tab, is there a way to do that? Currently, I use a Chrome extension to do it one tab at a time.

    1. Jan van den Berg Avatar

      Hi Jen, I am not sure about this, you would have to try to change the code yourself. Good luck! 🙂

  5. Geoff Plitt Avatar
    Geoff Plitt

    Thanks for the shout-out!

Leave a Reply

Your email address will not be published. Required fields are marked *