feed

package
v0.0.0-...-a743a9f Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

README

operate

./informer feed add github_golang_daily https://kaifa.baidu.com/rest/v1/home/github\?optionLanguage\=go\&optionSince\=DAILY
./informer feed list
./informer feed view 2
./informer feed update 2 weight 50
./informer feed update 2 max_fetch_num 5
./informer feed update 2 max_fetch_num 2
./informer feed update 2 regex ",\"url\":\"([^\"]+)\",\"title\":\"([^\"]+)\","
./informer feed update 2 title_group 2
./informer feed update 2 url_group 1
./informer feed view 2

# id:     2
# title:  github_golang_daily
# url:    https://kaifa.baidu.com/rest/v1/home/github?optionLanguage=go&optionSince=DAILY
# weight: 50
# max_fetch_num:  2
# regex:  ,"url":"([^"]+)","title":"([^"]+)",
# title_group:        2
# url_group: 1

./informer feed parse 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFeeds

func AddFeeds(buf io.StringWriter, config *Config)

func AddSource

func AddSource(title, link string)

func FormatURL

func FormatURL(link string) (string, bool)

func GetHostFromURL

func GetHostFromURL(host string) string

GetHostFromURL get host from url, host is www.blog.com if url is http://www.blog.com/page.html.

func GetHostPrefix

func GetHostPrefix(link string) string

GetHostPrefix get host prefix from url, prefix is http://www.blog.com if url is http://www.blog.com/page.html.

func InitFeedDB

func InitFeedDB(dataDir string)

func Operate

func Operate(ops []string)

func ParseGoFeed

func ParseGoFeed(source *Source) (*gofeed.Feed, error)

ParseGoFeed parse feed.

Types

type Article

type Article struct {
	ID        int64  `json:"id" gorm:"primarykey;AUTO_INCREMENT"`
	URL       string `json:"url" gorm:"index"`
	Title     string `json:"title"`
	Timestamp int64  `json:"timestamp"`
	Weight    int64  `json:"weight"`
	Informed  bool   `json:"informed" gorm:"index"`
	Score     int64  `json:"score" gorm:"index"`
}

func RegexParse

func RegexParse(source *Source) ([]*Article, error)

func UpdateAndFilterFeeds

func UpdateAndFilterFeeds(config *Config) []*Article

type Config

type Config struct {
	ID                int64 `json:"id" gorm:"primarykey;AUTO_INCREMENT"`
	MaxInformFeedSize int   `json:"max_inform_feed_size"`
	FeedExpireDays    int   `json:"feed_expire_days"`
	SameSiteMaxCount  int   `json:"same_site_max_count"`
	MaxFetchNum       int   `json:"max_fetch_num"`
}

type Detail

type Detail struct{}

type Source

type Source struct {
	ID          int64  `json:"id" gorm:"primarykey;AUTO_INCREMENT"`
	Title       string `json:"title"`
	URL         string `json:"url"`
	CURL        string `json:"curl"`
	Weight      int64  `json:"weight"`
	MaxFetchNum int    `json:"max_fetch_num"`
	Regex       string `json:"regex"`
	TitleExp    string `json:"title_exp"`
	URLExp      string `json:"url_exp"`
	Redirect    bool   `json:"redirect"` // if redirect the parsed url
	Sort        bool   `json:"sort"`     // whether sort the result
}

Jump to

Keyboard shortcuts

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