From 9b850886656bb2ecf192e6d9df63ea07d175de06 Mon Sep 17 00:00:00 2001 From: lost+skunk Date: Wed, 5 Jun 2024 14:32:40 +0300 Subject: User implementation and particaly groups --- user-group.go | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 user-group.go (limited to 'user-group.go') diff --git a/user-group.go b/user-group.go new file mode 100644 index 0000000..32342fb --- /dev/null +++ b/user-group.go @@ -0,0 +1,92 @@ +package devianter + +import ( + "strconv" + "strings" +) + +// структура группы или пользователя +type Group struct { + ErrorDescription string + Owner struct { + Group bool `json:"isGroup"` + Username string + } + Gruser struct { + ID int `json:"gruserId"` + Page struct { + Modules []struct { + Name string + ModuleData struct { + About struct { + Country, Website, WebsiteLabel, Gender, Tagline string + DeviantFor int64 + SocialLinks []struct { + Value string + } + TextContent text + Interests []struct { + Label, Value string + } + } + CoverDeviation struct { + Deviation deviantion `json:"coverDeviation"` + } + + // группы + GroupAbout struct { + Tagline string + CreatinDate time `json:"foundationTs"` + Description text + } + GroupAdmins struct { + Results []struct { + Username string + } + } + Folders struct { + Results []struct { + FolderId int + Name string + } + } + + // галерея + ModuleData struct { + Folder struct { + Username string + Pages int `json:"totalPageCount"` + Deviations []deviantion + } `json:"folderDeviations"` + } + } + } + } + } + PageExtraData struct { + GruserTagline string + Stats struct { + Deviations, Watchers, Watching, Pageviews, CommentsMade, Favourites, Friends int + FeedComments int `json:"commentsReceivedProfile"` + } + } +} + +func UGroup(name string) (g Group) { + ujson("dauserprofile/init/about?username="+name, &g) + + return +} + +// гарелея пользователя или группы +func Gallery(name string, page int) (g Group) { + var url strings.Builder + url.WriteString("dauserprofile/init/gallery?username=") + url.WriteString(name) + url.WriteString("&page=") + url.WriteString(strconv.Itoa(page)) + url.WriteString("&deviations_limit=50&with_subfolders=false") + + ujson(url.String(), &g) + return +} -- cgit v1.2.3