0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 13:13:00 -05:00

Fix integration errors

This commit is contained in:
dragongoose 2023-05-29 16:02:10 -04:00
parent 0628d99be2
commit 15e4de67ee
No known key found for this signature in database
GPG key ID: 50DB99B921579009
3 changed files with 8 additions and 8 deletions

View file

@ -13,9 +13,9 @@ func ParseSocials(data string) ([]structs.Social, error) {
result := gjson.Get(data, "user.channel.socialMedias") result := gjson.Get(data, "user.channel.socialMedias")
for _, social := range result.Array() { for _, social := range result.Array() {
parsedSocials = append(parsedSocials, structs.Social{ parsedSocials = append(parsedSocials, structs.Social{
Title: social.Get("title").String(), Name: social.Get("title").String(),
Type: social.Get("name").String(), Type: social.Get("name").String(),
Url: social.Get("url").String(), Url: social.Get("url").String(),
}) })
} }
@ -95,7 +95,7 @@ func ParseMinifiedStream(data gjson.Result) (structs.CategoryMinifiedStream, err
parsedStream := structs.CategoryMinifiedStream{ parsedStream := structs.CategoryMinifiedStream{
Title: data.Get("node.title").String(), Title: data.Get("node.title").String(),
Viewers: int(data.Get("node.viewersCount").Int()), Viewers: int(data.Get("node.viewersCount").Int()),
Preview: ProxyUrl(data.Get("previewImageURL").String()), Preview: ProxyUrl(data.Get("node.previewImageURL").String()),
Tags: tags, Tags: tags,
Streamer: structs.CategoryMinifiedStreamer{ Streamer: structs.CategoryMinifiedStreamer{
Name: data.Get("node.broadcaster.login").String(), Name: data.Get("node.broadcaster.login").String(),

View file

@ -3,9 +3,9 @@ package structs
import "time" import "time"
type Social struct { type Social struct {
Type string `json:"type"` Type string `json:"type"`
Title string `json:"title"` Name string `json:"name"`
Url string `json:"url"` Url string `json:"url"`
} }
type Stream struct { type Stream struct {

View file

@ -14,7 +14,7 @@ func ProxyUrl(url string) string {
type ServerFormat struct { type ServerFormat struct {
Status string `json:"status"` Status string `json:"status"`
Message interface{} `json:"message"` Message interface{} `json:"data"`
} }
func FormatMessage(data interface{}, ok bool) ServerFormat { func FormatMessage(data interface{}, ok bool) ServerFormat {