fetchers

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMAGE = iota
	TVIDEO
)
View Source
const (
	MaxTweetCount = "20"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFetcher

type BaseFetcher struct {
	UA string
	DB storm.Node
	// contains filtered or unexported fields
}

func (*BaseFetcher) Block added in v0.1.6

func (f *BaseFetcher) Block(string) string

func (*BaseFetcher) GetPush

func (f *BaseFetcher) GetPush(string, []string) []ReplyMessage

For channel update

func (*BaseFetcher) GetPushAtLeastOne

func (f *BaseFetcher) GetPushAtLeastOne(userid string, following []string) (ret []ReplyMessage)

For user request update

func (*BaseFetcher) GoBack

func (f *BaseFetcher) GoBack(string, int64) error

Set last update time to several seconds before

func (*BaseFetcher) HTTPGet

func (f *BaseFetcher) HTTPGet(url string) ([]byte, error)

func (*BaseFetcher) Init

func (f *BaseFetcher) Init(db *storm.DB, _ string) error

Initialize

type ExampleFetcher

type ExampleFetcher struct {
	BaseFetcher
}

func (*ExampleFetcher) GetPush

func (f *ExampleFetcher) GetPush(string, []string) []ReplyMessage

type Fetcher

type Fetcher interface {
	Init(*storm.DB, string) error                      // Initializing
	GetPush(string, []string) []ReplyMessage           // For channel message
	GetPushAtLeastOne(string, []string) []ReplyMessage // For user message
	GoBack(string, int64) error                        // Set last update time to N seconds before
	Block(string) string
}

type ReplyMessage

type ReplyMessage struct {
	Resources []Resource
	Caption   string
	Err       error
}

type Resource

type Resource struct {
	URL     string
	T       int
	Caption string
}

type TumblrFetcher

type TumblrFetcher struct {
	BaseFetcher
	OAuthConsumerKey    string `json:"consumer_key"`
	OAuthConsumerSecret string `json:"consumer_secret"`
	OAuthToken          string `json:"access_token"`
	OAuthTokenSecret    string `json:"access_token_secret"`
	// contains filtered or unexported fields
}

func (*TumblrFetcher) Block added in v0.1.6

func (f *TumblrFetcher) Block(caption string) string

func (*TumblrFetcher) GetPush

func (f *TumblrFetcher) GetPush(userid string, followings []string) []ReplyMessage

func (*TumblrFetcher) GoBack

func (f *TumblrFetcher) GoBack(userid string, back int64) error

func (*TumblrFetcher) Init

func (f *TumblrFetcher) Init(db *storm.DB, channel_id string) (err error)

type TumblrPosts

type TumblrPosts struct {
	Meta struct {
		Status int    `json:"status"`
		Msg    string `json:"msg"`
	} `json:"meta"`
	Response struct {
		Posts []struct {
			Type               string `json:"type"`
			BlogName           string `json:"blog_name"`
			ID                 int64  `json:"id"`
			PostURL            string `json:"post_url"`
			Slug               string `json:"slug"`
			Date               string `json:"date"`
			Timestamp          int    `json:"timestamp"`
			State              string `json:"state"`
			Format             string `json:"format"`
			ShortURL           string `json:"short_url"`
			IsBlocksPostFormat bool   `json:"is_blocks_post_format"`
			SourceURL          string `json:"source_url,omitempty"`
			SourceTitle        string `json:"source_title,omitempty"`
			Caption            string `json:"caption,omitempty"`
			Reblog             struct {
				Comment  string `json:"comment"`
				TreeHTML string `json:"tree_html"`
			} `json:"reblog"`
			Trail []struct {
				Post struct {
					ID interface{} `json:"id"`
				} `json:"post"`
				ContentRaw string `json:"content_raw"`
				Content    string `json:"content"`
			} `json:"trail"`
			VideoURL        string `json:"video_url,omitempty"`
			ThumbnailURL    string `json:"thumbnail_url,omitempty"`
			ThumbnailWidth  int    `json:"thumbnail_width,omitempty"`
			ThumbnailHeight int    `json:"thumbnail_height,omitempty"`
			Duration        int    `json:"duration,omitempty"`
			VideoType       string `json:"video_type,omitempty"`
			DisplayAvatar   bool   `json:"display_avatar"`
			PhotosetLayout  string `json:"photoset_layout,omitempty"`
			Photos          []struct {
				Caption      string `json:"caption"`
				OriginalSize struct {
					URL    string `json:"url"`
					Width  int    `json:"width"`
					Height int    `json:"height"`
				} `json:"original_size"`
			} `json:"photos,omitempty"`
			ImagePermalink string `json:"image_permalink,omitempty"`
			Title          string `json:"title,omitempty"`
			Body           string `json:"body,omitempty"`
		} `json:"posts"`
	} `json:"response"`
}

type TwitterFetcher

type TwitterFetcher struct {
	BaseFetcher

	AccessToken       string `json:"access_token"`
	AccessToeknSecret string `json:"access_token_secret"`
	ConsumerKey       string `json:"consumer_key"`
	ConsumerSecret    string `json:"consumer_secret"`
	// contains filtered or unexported fields
}

func (*TwitterFetcher) GetPush

func (f *TwitterFetcher) GetPush(userid string, followings []string) []ReplyMessage

func (*TwitterFetcher) GoBack

func (f *TwitterFetcher) GoBack(userid string, back int64) error

func (*TwitterFetcher) Init

func (f *TwitterFetcher) Init(db *storm.DB, channel_id string) (err error)

type V2EXFetcher

type V2EXFetcher struct {
	BaseFetcher
}

func (*V2EXFetcher) GetPush

func (f *V2EXFetcher) GetPush(string, []string) []ReplyMessage

type V2EXHot

type V2EXHot []struct {
	ID              int    `json:"id"`
	Title           string `json:"title"`
	URL             string `json:"url"`
	Content         string `json:"content"`
	ContentRendered string `json:"content_rendered"`
	Replies         int    `json:"replies"`
	Member          struct {
		ID           int    `json:"id"`
		Username     string `json:"username"`
		Tagline      string `json:"tagline"`
		AvatarMini   string `json:"avatar_mini"`
		AvatarNormal string `json:"avatar_normal"`
		AvatarLarge  string `json:"avatar_large"`
	} `json:"member"`
	Node struct {
		ID               int    `json:"id"`
		Name             string `json:"name"`
		Title            string `json:"title"`
		TitleAlternative string `json:"title_alternative"`
		URL              string `json:"url"`
		Topics           int    `json:"topics"`
		AvatarMini       string `json:"avatar_mini"`
		AvatarNormal     string `json:"avatar_normal"`
		AvatarLarge      string `json:"avatar_large"`
	} `json:"node"`
	Created      int `json:"created"`
	LastModified int `json:"last_modified"`
	LastTouched  int `json:"last_touched"`
}

Jump to

Keyboard shortcuts

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