historytrends

package
v0.0.0-...-ae58740 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package historytrends parses Chromium browsing history exports from the History Trends Unlimited extension.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Export

type Export struct {
	Filename   string // filename of tsv within zip or as given
	Type       ExportType
	ExportTime time.Time
	Visits     []Visit
}

Export contains browsing history exported from History Trends Unlimited. The export time is in the local timezone at the time the export was created. When the local timezone cannot be determined, the location is incorrectly set to UTC.

func (*Export) Write

func (ex *Export) Write(w io.Writer) error

Write writes the export to w.

type ExportType

type ExportType uint8

ExportType is the format of export.

const (
	AnalysisExport ExportType
	ArchivedExport
)

Values for ExportType:

func ParseExportFilename

func ParseExportFilename(filename string) (ExportType, time.Time, error)

ParseExportFilename extracts the type and time of export from the given filename. A suffix like "(1)" or "copy", for example, is permitted.

func (ExportType) String

func (typ ExportType) String() string

type ReadCloser

type ReadCloser struct {
	Reader
	// contains filtered or unexported fields
}

ReadCloser reads and closes a History Trends Unlimited browsing history export.

func OpenReader

func OpenReader(filename string) (*ReadCloser, error)

OpenReader opens a History Trends Unlimited browsing history export for reading.

func (*ReadCloser) Close

func (r *ReadCloser) Close() error

Close closes the underlying io.ReadCloser.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads a History Trends Unlimited browsing history export.

func NewReader

func NewReader(r io.Reader, exportTime time.Time) *Reader

NewReader returns a new Reader that reads from r.

func (*Reader) ExportTime

func (r *Reader) ExportTime() time.Time

ExportTime returns the time of export. For analysis exports, the timezone is initially UTC, then is determined upon reading the first record. For archived exports, the timezone is always UTC.

func (*Reader) Read

func (r *Reader) Read() (*Visit, error)

Read reads a single visit in an export.

func (*Reader) ReadAll

func (r *Reader) ReadAll() (*Export, error)

ReadAll reads all visits in an export.

type Visit

type Visit struct {
	URL        string
	VisitTime  time.Time // UTC
	Transition chrome.PageTransition
	PageTitle  string
}

Visit is a page visit in browsing history. URL and visit time combined are unique; no two visits have the same URL and visit time. The visit time is in UTC, not local time.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer writes a History Trends Unlimited browsing history export.

func NewWriter

func NewWriter(w io.Writer, typ ExportType, exportTime time.Time) (*Writer, error)

NewWriter returns a new Writer that writes to w.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush flushes any buffered data to the underlying io.Writer.

func (*Writer) Write

func (w *Writer) Write(v *Visit) error

Write writes a single visit in an export.

func (*Writer) WriteAll

func (w *Writer) WriteAll(visits []Visit) error

WriteAll writes all visits in an export.

Jump to

Keyboard shortcuts

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