bookmarks

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package bookmarks lets you fetch saved bookmarks from all common browsers databases. The New.. methods return a new BookmarkGrabber that implements the Grabber interface.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bookmark

type Bookmark struct {
	BookmarkGrabber
	DateAdded time.Time
	Name      string
	URL       string
	Type      BookmarkType
	// contains filtered or unexported fields
}

Bookmark represents a chromium browser bookmark. Bookmark can be of type URL or of type FOLDER

func NewChromiumGrabber added in v0.2.0

func NewChromiumGrabber(profile browserutils.ProfileDir, area BookmarkArea) (*Bookmark, error)

NewChromiumGrabber return a new grabber of type Bookmark, with the wanted BookmarkArea.

Example
profiles, err := browserutils.GetChromiumProfileDirs()
if err != nil {
	log.Fatal(err)
}
profile := profiles[0]

bookmarks, err := NewChromiumGrabber(profile, BOOKMARK_BAR)
if err != nil {
	log.Fatal(err)
}

for b := range bookmarks.Iterate() {
	if b.IsFolder() {
		fmt.Println(b.Name, b.DateAdded)
	} else {
		fmt.Println(b.Name, b.URL, b.DateAdded)
	}
}
Output:

func (*Bookmark) Close

func (b *Bookmark) Close() error

Close stops any future calls to Next and Scan

func (Bookmark) Err

func (b Bookmark) Err() error

func (Bookmark) IsFolder

func (b Bookmark) IsFolder() bool

IsFolder returns true if the bookmark type is folder. This will help you to iterate on nested bookmarks and folders.

func (*Bookmark) Iterate

func (b *Bookmark) Iterate() <-chan Bookmark

Iterate lets you iterate on all the available bookmarks with a basic for loop.

func (*Bookmark) Next

func (b *Bookmark) Next() bool

Next prepare the next bookmark to be returned. You can call Next only of bookmarks of type FOLDER.

func (*Bookmark) Scan

func (b *Bookmark) Scan(dest interface{}) error

Scan scans the next bookmark entry and returns it into the dest. You can call Scan only of bookmarks of type FOLDER.

type BookmarkArea

type BookmarkArea int
const (
	BOOKMARK_BAR BookmarkArea = iota
	OTHER
	SYNCED
)

func (BookmarkArea) String

func (b BookmarkArea) String() string

type BookmarkGrabber

type BookmarkGrabber interface {
	Iterate() <-chan Bookmark
	brograb.Grabber
}

BookmarkGrabber extends the Grabber interface, for bookmarks specific grabbing.

type BookmarkType

type BookmarkType int
const (
	URL BookmarkType = iota
	FOLDER
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL