mirror of
https://git.macaw.me/skunky/devianter.git
synced 2025-04-27 19:45:08 +03:00
Парсер медии с кастомным разрешением
This commit is contained in:
parent
4d166ad5f9
commit
42ea2980f9
9 changed files with 105 additions and 106 deletions
|
@ -1,44 +1,12 @@
|
|||
package devianter
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// структура группы или пользователя
|
||||
type GroupAbout struct {
|
||||
FoundatedAt time `json:"foundationTs"`
|
||||
Description Text
|
||||
}
|
||||
type GroupAdmins struct {
|
||||
Results []struct {
|
||||
TypeId int
|
||||
User struct {
|
||||
Username string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type About struct {
|
||||
Country, Website, WebsiteLabel, Gender string
|
||||
RegDate int64 `json:"deviantFor"`
|
||||
Description Text `json:"textContent"`
|
||||
|
||||
SocialLinks []struct {
|
||||
Value string
|
||||
}
|
||||
Interests []struct {
|
||||
Label, Value string
|
||||
}
|
||||
}
|
||||
|
||||
type users struct {
|
||||
About About
|
||||
CoverDeviation struct {
|
||||
Deviation Deviation `json:"coverDeviation"`
|
||||
}
|
||||
}
|
||||
|
||||
type GRuser struct {
|
||||
ErrorDescription string
|
||||
Owner struct {
|
||||
|
@ -106,14 +74,21 @@ type Group struct {
|
|||
}
|
||||
|
||||
// подходит как группа, так и пользователь
|
||||
func (s Group) GroupFunc() (g GRuser) {
|
||||
func (s Group) GetGroup() (g GRuser, err error) {
|
||||
if s.Name == "" {
|
||||
return g, errors.New("missing Name field")
|
||||
}
|
||||
ujson("dauserprofile/init/about?username="+s.Name, &g)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// гарелея пользователя или группы
|
||||
func (s Group) Gallery(page int, folderid ...int) (g Group) {
|
||||
func (s Group) GetGallery(page int, folderid ...int) (g Group, err error) {
|
||||
if s.Name == "" {
|
||||
return g, errors.New("missing Name field")
|
||||
}
|
||||
|
||||
var url strings.Builder
|
||||
if folderid[0] > 0 {
|
||||
page--
|
||||
|
@ -137,3 +112,36 @@ func (s Group) Gallery(page int, folderid ...int) (g Group) {
|
|||
ujson(url.String(), &g.Content)
|
||||
return
|
||||
}
|
||||
|
||||
type GroupAbout struct {
|
||||
FoundatedAt timeStamp `json:"foundationTs"`
|
||||
Description Text
|
||||
}
|
||||
type GroupAdmins struct {
|
||||
Results []struct {
|
||||
TypeId int
|
||||
User struct {
|
||||
Username string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type About struct {
|
||||
Country, Website, WebsiteLabel, Gender string
|
||||
RegDate int64 `json:"deviantFor"`
|
||||
Description Text `json:"textContent"`
|
||||
|
||||
SocialLinks []struct {
|
||||
Value string
|
||||
}
|
||||
Interests []struct {
|
||||
Label, Value string
|
||||
}
|
||||
}
|
||||
|
||||
type users struct {
|
||||
About About
|
||||
CoverDeviation struct {
|
||||
Deviation Deviation `json:"coverDeviation"`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue