utils

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(path string) bool

DirExists returns true if the directory is present on disk

func ExtractTextFromHTML

func ExtractTextFromHTML(s string) string

ExtractTextFromHTML returns a string with only the text version of the web page

func FileExists

func FileExists(filename string) bool

FileExists returns true if the file is present on disk

func IsFlagPassed

func IsFlagPassed(name string) bool

IsFlagPassed returns true if the flag is present on the command line

func ParseCookieFile

func ParseCookieFile(filename string) ([]*http.Cookie, error)

ParseCookieFile transforms JSON file in slice of http.Cookie

Types

type Cookies

type Cookies []struct {
	Domain         string  `json:"domain"`
	ExpirationDate float64 `json:"expirationDate,omitempty"`
	HostOnly       bool    `json:"hostOnly"`
	HTTPOnly       bool    `json:"httpOnly"`
	Name           string  `json:"name"`
	Path           string  `json:"path"`
	SameSite       string  `json:"sameSite"`
	Secure         bool    `json:"secure"`
	Session        bool    `json:"session"`
	StoreID        string  `json:"storeId"`
	Value          string  `json:"value"`
	ID             int     `json:"id"`
}

Cookies maps the json file exported from Chrome containing the cookies

type HTMLMeta

type HTMLMeta struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Image       string `json:"image"`
	SiteName    string `json:"site_name"`
}

HTMLMeta contains information from the HTML page

func GetMetaFromHTML

func GetMetaFromHTML(s string) *HTMLMeta

GetMetaFromHTML extracts info from an HTML page and store them on a HTMLMeta struct

Jump to

Keyboard shortcuts

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