diff --git a/entity/models.go b/entity/models.go index a7045d6..ebf9a04 100644 --- a/entity/models.go +++ b/entity/models.go @@ -9,7 +9,7 @@ type Illust struct { ID int `json:"id"` Title string `json:"title"` Caption template.HTML `json:"caption"` - Artist UserBrief `json:"user"` + Artist User `json:"user"` Date time.Time `json:"create_date"` Pages int `json:"page_count"` Views int `json:"total_view"` @@ -32,29 +32,23 @@ type Tag struct { } type User struct { - User UserBrief `json:"user"` - Profile UserProfile `json:"profile"` -} - -type UserBrief struct { - ID int `json:"id"` - Name string `json:"name"` - Account string `json:"account"` - Avatar map[string]string `json:"profile_image_urls"` -} - -type UserProfile struct { - Webpage string `json:"webpage"` - Gender string `json:"gender"` - Birth string `json:"birth"` - BirthDay string `json:"birth_day"` - BirthYear int `json:"birth_year"` - Region string `json:"region"` - BackgroundImage string `json:"background_image_url"` - Followers int `json:"total_follow_users"` - MyPixiv int `json:"total_mypixiv_users"` - TwitterURL string `json:"twitter_url"` - PawooURL string `json:"pawoo_url"` + ID int `json:"id"` + Name string `json:"name"` + Account string `json:"account"` + Avatar map[string]string `json:"profile_image_urls"` + Webpage string `json:"webpage"` + Gender string `json:"gender"` + Birth string `json:"birth"` + BirthDay string `json:"birth_day"` + BirthYear int `json:"birth_year"` + Region string `json:"region"` + BackgroundImage string `json:"background_image_url"` + Followers int `json:"total_follow_users"` + MyPixiv int `json:"total_mypixiv_users"` + Illusts int `json:"total_illusts"` + Mangas int `json:"total_mangas"` + TwitterURL string `json:"twitter_url"` + PawooURL string `json:"pawoo_url"` } type Image struct { diff --git a/handler/parser.go b/handler/parser.go index 296af85..bb7bb98 100644 --- a/handler/parser.go +++ b/handler/parser.go @@ -184,7 +184,15 @@ func GetUserInfo(c *gin.Context) (entity.User, error) { var user entity.User s := Request(URL) - err := json.Unmarshal([]byte(s), &user) + user_string := GetInnerJSON(s, "user") + profile_string := GetInnerJSON(s, "profile") + + err := json.Unmarshal([]byte(user_string), &user) + if err != nil { + panic("Failed to parse JSON") + } + + err = json.Unmarshal([]byte(profile_string), &user) if err != nil { panic("Failed to parse JSON") } diff --git a/template/css/style.css b/template/css/style.css index 60536b6..9bc0dae 100644 --- a/template/css/style.css +++ b/template/css/style.css @@ -65,8 +65,6 @@ body { font-size: 0.9rem; } .artwork-thumbnail .artwork-master-image { - width: 100%; - height: 100%; object-position: center center; } .artwork-thumbnail .artwork-thumbnail-artist { @@ -88,10 +86,12 @@ body { .artwork-thumbnail-small { width: 184px; + height: 184px; } .artwork-thumbnail-large { width: 288px; + height: 288px; } .spotlight-thumbnail { diff --git a/template/css/style.scss b/template/css/style.scss index ddedbd7..d7a5b1e 100644 --- a/template/css/style.scss +++ b/template/css/style.scss @@ -79,8 +79,6 @@ body { } .artwork-master-image { - width: 184px; - height: 184px; object-position: center center; } @@ -108,10 +106,12 @@ body { .artwork-thumbnail-small { width: 184px; + height: 184px; } .artwork-thumbnail-large { width: 288px; + height: 288px; } .spotlight-thumbnail { diff --git a/template/user.html b/template/user.html index 15596e2..ef177cc 100644 --- a/template/user.html +++ b/template/user.html @@ -1,6 +1,6 @@ -{{ template "header.html" }} {{ $Recent := .Recent }} {{ with .User }} +{{ template "header.html" }}
- alt + {{ .User.Name }}
@@ -8,12 +8,12 @@ avatar

{{ .User.Name }}

@{{ .User.Account }}

-

{{ .Profile.Followers }} Following | {{ .Profile.MyPixiv }} MyPixiv

+

{{ .User.Followers }} Following | {{ .User.MyPixiv }} MyPixiv

Illustrations and Mangas

- {{ template "small-tn.html" $Recent }} + {{ template "small-tn.html" .Recent }}
-{{ end }} {{ template "footer.html" }} +{{ template "footer.html" }}