Documentation ¶
Index ¶
- Constants
- func UidFromBucketName(name string) string
- func UserBucket(uid string) string
- func ValidateSyncerConfig(config SyncerConfig) (err error)
- type ChannelConf
- type Config
- type ContentTypes
- type CookieAcceptor
- type Cookies
- type Filter
- type HttpCli
- type ImageQuality
- type SessionConfig
- type SyncerConfig
- type UserChannels
- type VideoQuality
- type WebServerConfig
Constants ¶
View Source
const ( ExtraImagesKey = "archiveImages" ExtraVideoKey = "archiveVideo" )
View Source
const ( MimeVideo = "video/mp4" MimeImage = "image/jpeg" )
View Source
const ( BucketFav = "fav" BucketMyPosts = "mine" BucketByUserPrefix = "user" BucketUserProfile = "profile" )
View Source
const ProfileAvatarImageKey = "archiveAvatar"
View Source
const RandomSleepMaxSeconds = 10
Variables ¶
This section is empty.
Functions ¶
func UidFromBucketName ¶
func UserBucket ¶
func ValidateSyncerConfig ¶
func ValidateSyncerConfig(config SyncerConfig) (err error)
Types ¶
type ChannelConf ¶
type ChannelConf struct { // if this channel enabled Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"` // starting page for sync job StartPage int `yaml:"startPage,omitempty" json:"startPage,omitempty"` // sync job stops immediately when it meets existing tweet id when IncrementalMode set to true IncrementalMode *bool `yaml:"incrementalMode" json:"incrementalMode"` // content fetching behavior ContentTypes ContentTypes `yaml:"contentTypes" json:"contentTypes"` // tweets will be archived only when it's content match the Includes regex Includes string `yaml:"includes,omitempty" json:"includes,omitempty"` // tweets will not be archived when it's content match the Excludes regex Excludes string `yaml:"excludes,omitempty" json:"excludes,omitempty"` // only original tweets will be archived OriginalOnly *bool `yaml:"originalOnly,omitempty" json:"originalOnly,omitempty"` }
type Config ¶
type Config struct { Syncer SyncerConfig `yaml:"syncer" json:"syncer"` Server WebServerConfig `yaml:"server" json:"server"` DatabasePath string `yaml:"databasePath" json:"-"` Session SessionConfig `yaml:"session" json:"session"` // contains filtered or unexported fields }
Config for dashboard server behavior
type ContentTypes ¶
type ContentTypes struct { // fetch long tweet if LongText set to true LongText bool `yaml:"longText" json:"longText"` // fetch thumbnail for web ui if Thumbnail set to true Thumbnail bool `yaml:"thumbnail" json:"thumbnail"` // images fetching quality, available options: best, large, middle, none ImageQuality ImageQuality `yaml:"imageQuality" json:"imageQuality"` // videos fetching quality, available options: best, 720p, 360p, none VideoQuality VideoQuality `yaml:"videoQuality" json:"videoQuality"` }
ContentTypes for content fetching behavior
type CookieAcceptor ¶
type CookieAcceptor interface {
Accept(cookie string)
}
type Filter ¶
type Filter struct { // list won't return it if the tweet containers word in filter word list Word []string `json:"word" json:"word"` // list won't return it if the tweet id in filter id list Id []string `json:"id" json:"id"` }
Filter configuration for list handler
type ImageQuality ¶
type ImageQuality string
const ( ImageQualityBest ImageQuality = "best" ImageQualityLarge ImageQuality = "large" ImageQualityMiddle ImageQuality = "middle" ImageQualityNone ImageQuality = "none" )
func (ImageQuality) Get ¶
Get image url, input item structure
{ "thumbnail": { "url": "https://xxxx.jpg", "width": 1, "height": 2, }, "bmiddle": {}, "large": {}, "original": {}, "largest": {}, "mw2000": {}, }
func (ImageQuality) Valid ¶
func (q ImageQuality) Valid() error
Valid check if it is valid image quality option
type SessionConfig ¶
type SessionConfig struct {
CookiePath string `yaml:"cookiePath" json:"cookiePath"`
}
type SyncerConfig ¶
type SyncerConfig struct { // weibo uid Uid string `yaml:"uid" json:"uid"` // weibo cookie Cookie string `yaml:"cookie" json:"cookie"` // crontab like string, for sync job run schedule Cron string `yaml:"cron" json:"cron"` // my favorite channel config Favorite *ChannelConf `yaml:"favorite,omitempty" json:"favorite,omitempty"` // user channel config User UserChannels `yaml:"user,omitempty" json:"user,omitempty"` // default channel conf, can be overwritten DefaultChannelConf *ChannelConf `yaml:"defaultChannelConf,omitempty" json:"defaultChannelConf,omitempty"` // use a random sleep RandomSleep bool `yaml:"randomSleep,omitempty" json:"randomSleep,omitempty"` }
SyncerConfig for sync task
type UserChannels ¶
type UserChannels struct { // custom channel config Custom map[string]*ChannelConf `yaml:"custom,omitempty" json:"custom,omitempty"` // common list use default channel conf UserIdList []string `yaml:"userIdList,omitempty" json:"userIdList,omitempty"` // contains filtered or unexported fields }
func (*UserChannels) GetUsers ¶
func (u *UserChannels) GetUsers() map[string]*ChannelConf
type VideoQuality ¶
type VideoQuality string
const ( VideoQualityBest VideoQuality = "best" VideoQuality720p VideoQuality = "720p" VideoQuality360p VideoQuality = "360p" VideoQualityNone VideoQuality = "none" )
func (VideoQuality) Valid ¶
func (q VideoQuality) Valid() error
Valid check if it is valid video quality option
type WebServerConfig ¶
type WebServerConfig struct { // web serving address (ip:port) Addr string `yaml:"addr" json:"addr"` // list api filter Filter Filter `yaml:"filter" json:"filter"` }
WebServerConfig for api server
Click to show internal directories.
Click to hide internal directories.