utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSearchResults = 100
)

Variables

View Source
var (
	USER_AGENTS = []string{}/* 184 elements not displayed */

	RandomUserAgent = func() string {
		return USER_AGENTS[rand.Intn(len(USER_AGENTS))]
	}
)
View Source
var (
	GOOGLE_NEWS_REGEX = `^http(s)?://(www.)?news.google.com*`

	ErrEmptyQuery = fmt.Errorf("query cannot be empty")

	ErrEmptyTopic = fmt.Errorf("topic cannot be empty")

	ErrInvalidTopic = fmt.Errorf("invalid topic")

	ErrEmptyLocation = fmt.Errorf("location cannot be empty")

	ErrFailedToGetNewsContent = fmt.Errorf("failed to get news content")

	ErrEmptyLink = fmt.Errorf("link cannot be empty")
)

Functions

func CleanDescription

func CleanDescription(html string) string

func CleanHTML

func CleanHTML(html string) string

func GetFeedItems

func GetFeedItems(client *http.Client, req *http.Request) ([]*gofeed.Item, error)

get feed items

func GetOriginalLink(sourceLink string) (string, error)

GetOriginalLink gets the original link

func IsExcludedSource

func IsExcludedSource(url string, excludeWebsites *[]string) bool

IsExcludedSource checks if the item's link is from an excluded website

func IsGoogleNewsLink(link string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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