Skip to content

abhijit-hota/netscaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference

Netscaper

What is it?

A Netscape Bookmark File parser. In case you don't know what that is, it's the bookmarks.html browsers blurt out when you Export bookmarks as HTML.

This library takes such files and outputs an array of bookmarks.

Features

  • ✅ Parse bookmarked items
    • ✅ Title, link, tags, date added, last modified
    • ✅ Descriptions inside <DD>
    • PRIVATE attributes
    • LAST_VISITED attributes
  • ✅ Parse Folders
    • ✅ outputs the full folder path when in flattened mode
    • 🚧 exposes functions to output a folder tree
    • 🚧 handles folder with the same name and level

Usage

package main

import (
	"github.com/abhijit-hota/netscaper"
)

func main() {
    // If you have a file
    pathToFile := "./bookmarks.html"
	books, err := netscaper.ParseFromFile(pathToFile, nil /* default options */)
	if err != nil {
		panic(err)
	}

    // If you have a string with the file contents:
    contents := "..." 
  	books, err := netscaper.Parse(contents, nil /* default options */)
	if err != nil {
		panic(err)
	} 
}

Check the API reference for more.

Notes & References

The code uses regexes to parse HTML. Sigh. I might rewrite this using the html package or using lexical scanning but this was written for a really specific purpose and here we are.

15 years ago this library would be all the rage.

- Me

About

A parser for the Netscape Bookmark File format

Topics

Resources

License

Stars

Watchers

Forks

Languages