Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ DonationLink = "#DonationLink"
Domain = "humanz.tech"
LowResources = true

[BannFanartAccount]
Twitter = ["VtuberAnlysBot"]

YoutubeToken = [
"#GoogleAPI",
"#GoogleAPI"
Expand Down
31 changes: 18 additions & 13 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,24 @@ const (

//ConfigFile config file struct for config.toml
type ConfigFile struct {
Discord string `toml:"Discord"`
BiliSess string `toml:"BiliSess"`
PixivSession string `toml:"PixivSess"`
SauceAPI string `toml:"SauceAPI"`
InviteLog string `toml:"InviteLog"`
PilotReporting string `toml:"PilotReporting"`
MultiTOR string `toml:"Multitor"`
DonationLink string `toml:"DonationLink"`
TopGG string `toml:"TOPGG"`
Domain string `toml:"Domain"`
PrometheusURL string `toml:"PrometheusURL"`
Metric bool `toml:"Metric"`
Twitch struct {
Discord string `toml:"Discord"`
BiliSess string `toml:"BiliSess"`
PixivSession string `toml:"PixivSess"`
SauceAPI string `toml:"SauceAPI"`
InviteLog string `toml:"InviteLog"`
PilotReporting string `toml:"PilotReporting"`
MultiTOR string `toml:"Multitor"`
DonationLink string `toml:"DonationLink"`
TopGG string `toml:"TOPGG"`
Domain string `toml:"Domain"`
PrometheusURL string `toml:"PrometheusURL"`
Metric bool `toml:"Metric"`
BannFanartAccount struct {
Twitter []string `toml:"Twitter"`
BiliBili []string `toml:"BiliBili"`
Pixiv []string `toml:"Pixiv"`
} `toml:"BannFanartAccount"`
Twitch struct {
ClientID string `toml:"ClientID"`
ClientSecret string `toml:"ClientSecret"`
} `toml:"Twitch"`
Expand Down
76 changes: 43 additions & 33 deletions pkg/database/fanart.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,40 +555,50 @@ func (Member Member) ScrapTwitterFanart(Scraper *twitterscraper.Scraper, Lewd bo
continue
}

for _, TweetHashtag := range tweet.Hashtags {
if (strings.EqualFold("#"+TweetHashtag, Member.TwitterHashtag) || strings.EqualFold("#"+TweetHashtag, Member.TwitterLewd)) && !tweet.IsQuoted && !tweet.IsReply && len(tweet.Photos) > 0 {
TweetArt := DataFanart{
PermanentURL: tweet.PermanentURL,
Author: tweet.Username,
AuthorAvatar: func() string {
profile, err := Scraper.GetProfile(tweet.Username)
if err != nil {
log.Error(err)
}
return strings.Replace(profile.Avatar, "normal.jpg", "400x400.jpg", -1)
}(),
TweetID: tweet.ID,
Text: func() string {
return regexp.MustCompile(`(?m)^(.*?)https:\/\/t.co\/.+`).ReplaceAllString(tweet.Text, "${1}$2")
}(),
Photos: tweet.Photos,
Likes: tweet.Likes,
Member: Member,
State: config.TwitterArt,
Lewd: Lewd,
Group: Member.Group,
}
if tweet.Videos != nil {
TweetArt.Videos = tweet.Videos[0].Preview
}

New, err := TweetArt.CheckTweetFanArt(update)
if err != nil {
return nil, err
}
for _, Ban := range config.GoSimpConf.BannFanartAccount.Twitter {
if strings.EqualFold(Ban, tweet.Username) {
continue
}
}

if New {
FanartList = append(FanartList, TweetArt)
if !tweet.IsQuoted && !tweet.IsReply && len(tweet.Photos) > 0 {
for _, TweetHashtag := range tweet.Hashtags {
if strings.EqualFold("#"+TweetHashtag, Member.TwitterHashtag) || strings.EqualFold("#"+TweetHashtag, Member.TwitterLewd) {
TweetArt := DataFanart{
PermanentURL: tweet.PermanentURL,
Author: tweet.Username,
AuthorAvatar: func() string {
profile, err := Scraper.GetProfile(tweet.Username)
if err != nil {
log.Error(err)
}
return strings.Replace(profile.Avatar, "normal.jpg", "400x400.jpg", -1)
}(),
TweetID: tweet.ID,
Text: func() string {
return regexp.MustCompile(`(?m)^(.*?)https:\/\/t.co\/.+`).ReplaceAllString(tweet.Text, "${1}$2")
}(),
Photos: tweet.Photos,
Likes: tweet.Likes,
Member: Member,
State: config.TwitterArt,
Lewd: Lewd,
Group: Member.Group,
}
if tweet.Videos != nil {
TweetArt.Videos = tweet.Videos[0].Preview
}

New, err := TweetArt.CheckTweetFanArt(update)
if err != nil {
return nil, err
}

if New {
FanartList = append(FanartList, TweetArt)
}

break
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions service/fanart/bilibili/bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"flag"
"net/url"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -216,6 +217,13 @@ func (k *checkBlJob) Run() {
"Vtuber": Member.Name,
}).Error(err)
}

for _, Ban := range config.GoSimpConf.BannFanartAccount.BiliBili {
if strings.EqualFold(Ban, v.Desc.UserProfile.Info.Uname) {
continue
}
}

if STB.Item.Pictures != nil && v.Desc.Type == 2 { //type 2 is picture post (prob,heheheh)
for _, pic := range STB.Item.Pictures {
img = append(img, pic.ImgSrc)
Expand Down
6 changes: 6 additions & 0 deletions service/fanart/pixiv/pixiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ func Pixiv(p string, FixFanArt *database.DataFanart, l bool) error {
TextFix string
)

for _, Ban := range config.GoSimpConf.BannFanartAccount.Pixiv {
if strings.EqualFold(Ban, v2["userName"].(string)) {
continue
}
}

if IsVtuber {
if v2["xRestrict"].(float64) == 0 && !l {
illusbyte, err := network.Curl(config.PixivIllustsEnd+v2["id"].(string), nil)
Expand Down