Skip to content

Commit

Permalink
feat: auto fetch for source twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
krau committed Nov 1, 2024
1 parent 6d1807a commit fa1edb2
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 463 deletions.
7 changes: 5 additions & 2 deletions config/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ type SourcePixivConfig struct {
}

type SourceTwitterConfig struct {
Enable bool `toml:"enable" mapstructure:"enable" json:"enable" yaml:"enable"`
FxTwitterDomain string `toml:"fx_twitter_domain" mapstructure:"fx_twitter_domain" json:"fx_twitter_domain" yaml:"fx_twitter_domain"`
Enable bool `toml:"enable" mapstructure:"enable" json:"enable" yaml:"enable"`
FxTwitterDomain string `toml:"fx_twitter_domain" mapstructure:"fx_twitter_domain" json:"fx_twitter_domain" yaml:"fx_twitter_domain"`
Sleep uint `toml:"sleep" mapstructure:"sleep" json:"sleep" yaml:"sleep"`
Intervel int `toml:"intervel" mapstructure:"intervel" json:"intervel" yaml:"intervel"`
URLs []string `toml:"urls" mapstructure:"urls" json:"urls" yaml:"urls"`
}

type SourceBilibiliConfig struct {
Expand Down
11 changes: 11 additions & 0 deletions config/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ func InitConfig() {
viper.SetDefault("log.file_path", "logs/ManyACG.log")
viper.SetDefault("log.backup_num", 7)

viper.SetDefault("source.pixiv.enable", true)
viper.SetDefault("source.twitter.enable", true)
viper.SetDefault("source.bilibili.enable", true)
viper.SetDefault("source.danbooru.enable", true)
viper.SetDefault("source.kemono.enable", true)

viper.SetDefault("source.pixiv.intervel", 60)
viper.SetDefault("source.pixiv.sleep", 1)

viper.SetDefault("source.twitter.fx_twitter_domain", "fxtwitter.com")
viper.SetDefault("source.twitter.sleep", 1)
viper.SetDefault("source.twitter.intervel", 60)

viper.SetDefault("storage.cache_dir", "./cache")
viper.SetDefault("storage.cache_ttl", 86400)
Expand Down
65 changes: 35 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,41 @@ go 1.23
toolchain go1.23.1

require (
github.com/appleboy/gin-jwt/v2 v2.9.2
github.com/appleboy/gin-jwt/v2 v2.10.0
github.com/blang/semver v3.5.1+incompatible
github.com/chenyahui/gin-cache v1.9.0
github.com/corona10/goimagehash v1.1.0
github.com/duke-git/lancet/v2 v2.3.2
github.com/duke-git/lancet/v2 v2.3.3
github.com/gabriel-vasile/mimetype v1.4.6
github.com/gin-contrib/cors v1.7.2
github.com/gin-gonic/gin v1.10.0
github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.6.0
github.com/gookit/slog v0.5.6
github.com/gookit/slog v0.5.7
github.com/gorilla/feeds v1.2.0
github.com/penglongli/gin-metrics v0.1.10
github.com/resend/resend-go/v2 v2.12.0
github.com/penglongli/gin-metrics v0.1.12
github.com/resend/resend-go/v2 v2.13.0
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/studio-b12/gowebdav v0.9.0
github.com/u2takey/ffmpeg-go v0.5.0
go.mongodb.org/mongo-driver v1.16.1
go.mongodb.org/mongo-driver v1.17.1
golang.org/x/crypto v0.28.0
golang.org/x/image v0.19.0
golang.org/x/image v0.21.0
)

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.38.20 // indirect
github.com/PuerkitoBio/goquery v1.8.0 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/bits-and-blooms/bitset v1.14.3 // indirect
github.com/bytedance/sonic v1.12.3 // indirect
github.com/bytedance/sonic/loader v0.2.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
Expand All @@ -52,7 +54,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
github.com/grbit/go-json v0.11.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -61,54 +63,57 @@ require (
github.com/jellydator/ttlcache/v2 v2.11.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mmcdole/gofeed v1.3.0 // indirect
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/onsi/ginkgo/v2 v2.20.0 // indirect
github.com/onsi/ginkgo/v2 v2.21.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.46.0 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.48.1 // indirect
github.com/refraction-networking/utls v1.6.7 // indirect
github.com/savsgio/gotils v0.0.0-20240704082632-aef3928b8a38 // indirect
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/u2takey/go-utils v0.3.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
github.com/valyala/fasthttp v1.57.0 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/mock v0.5.0 // indirect
golang.org/x/arch v0.11.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/tools v0.26.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
)

require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/gookit/goutil v0.6.16 // indirect
github.com/gookit/goutil v0.6.17 // indirect
github.com/gookit/gsr v0.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imroc/req/v3 v3.43.7
github.com/imroc/req/v3 v3.48.0
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mymmrac/telego v0.31.1
github.com/mymmrac/telego v0.31.4
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand All @@ -120,7 +125,7 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
Expand Down
Loading

0 comments on commit fa1edb2

Please sign in to comment.