Небольшие допилы

This commit is contained in:
lost+skunk 2024-07-13 21:40:17 +03:00
parent 0a6260b2e0
commit 4d166ad5f9
2 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,7 @@ func (t *time) UnmarshalJSON(b []byte) (err error) {
type Deviation struct { type Deviation struct {
Title, Url, License string Title, Url, License string
PublishedTime time PublishedTime time
ID int `json:"deviationId"`
NSFW bool `json:"isMature"` NSFW bool `json:"isMature"`
AI bool `json:"isAiGenerated"` AI bool `json:"isAiGenerated"`
@ -40,6 +41,12 @@ type Deviation struct {
Tags []struct { Tags []struct {
Name string Name string
} }
OriginalFile struct {
Type string
Width int
Height int
Filesize int
}
DescriptionText Text DescriptionText Text
RelatedContent []struct { RelatedContent []struct {
Deviations []Deviation Deviations []Deviation
@ -89,7 +96,7 @@ func UrlFromMedia(m Media) string {
if t.T == "fullview" { if t.T == "fullview" {
url.WriteString(m.BaseUri) url.WriteString(m.BaseUri)
if m.BaseUri[len(m.BaseUri)-3:] != "gif" && t.W*t.H < 33177600 { if m.BaseUri[len(m.BaseUri)-3:] != "gif" && t.W*t.H < 33177600 {
url.WriteString("/v1/fill/w_") url.WriteString("/v1/fit/w_")
url.WriteString(strconv.Itoa(t.W)) url.WriteString(strconv.Itoa(t.W))
url.WriteString(",h_") url.WriteString(",h_")
url.WriteString(strconv.Itoa(t.H)) url.WriteString(strconv.Itoa(t.H))

View File

@ -79,7 +79,9 @@ type Gallery struct {
HasMore bool HasMore bool
Results []struct { Results []struct {
FolderId int FolderId int
Size int
Name string Name string
Thumb Deviation
} }
} }