Commit efa4b86a67

efa4b86a67d67ce9ff1ff19391dbf73f13daece6

parent: cec788554a

Unsigned

lost+skunk <skunky@ebloid.ru> · 2024-06-27 11:52 UTC

крымские наработки

Layout: unified · split

.vscode/launch.json added +16
@@ -0,0 +1,16 @@
1{
2 // Use IntelliSense to learn about possible attributes.
3 // Hover to view descriptions of existing attributes.
4 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 "version": "0.2.0",
6 "configurations": [
7 {
8 "name": "Launch Package",
9 "type": "go",
10 "request": "launch",
11 "mode": "debug",
12 "program": "${fileDirname}",
13 "showLog": true
14 }
15 ]
16}
\ No newline at end of file
comments.go +1 −1
@@ -23,7 +23,7 @@ type Comments struct {
2323 Desctiption string
2424 Comment string
2525
26 TextContent text
26 TextContent Text
2727
2828 User struct {
2929 Username string
deviantion.go +6 −6
@@ -35,21 +35,21 @@ type Deviation struct {
3535 Stats struct {
3636 Favourites, Views, Downloads int
3737 }
38 Media media
38 Media Media
3939 Extended struct {
4040 Tags []struct {
4141 Name string
4242 }
43 DescriptionText text
43 DescriptionText Text
4444 RelatedContent []struct {
4545 Deviations []Deviation
4646 }
4747 }
48 TextContent text
48 TextContent Text
4949}
5050
5151// её выпердыши
52type media struct {
52type Media struct {
5353 BaseUri string
5454 Token []string
5555 Types []struct {
@@ -58,7 +58,7 @@ type media struct {
5858 }
5959}
6060
61type text struct {
61type Text struct {
6262 Excerpt string
6363 Html struct {
6464 Markup, Type string
@@ -83,7 +83,7 @@ type Post struct {
8383}
8484
8585// преобразование урла в правильный
86func UrlFromMedia(m media) string {
86func UrlFromMedia(m Media) string {
8787 var url strings.Builder
8888 for _, t := range m.Types {
8989 if t.T == "fullview" {
misc.go +8 −10
@@ -48,14 +48,12 @@ func request(uri string, other ...string) reqrt {
4848 req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0.0")
4949
5050 // куки и UA-шник
51 if other != nil {
52 for num, rng := range other {
53 switch num {
54 case 1:
55 req.Header.Set("User-Agent", rng)
56 case 0:
57 req.Header.Set("Cookie", rng)
58 }
51 for num, rng := range other {
52 switch num {
53 case 1:
54 req.Header.Set("User-Agent", rng)
55 case 0:
56 req.Header.Set("Cookie", rng)
5957 }
6058 }
6159
@@ -112,7 +110,7 @@ func AEmedia(name string, t rune) (string, error) {
112110 }
113111 }
114112
115 return "", errors.New("User not exists")
113 return "", errors.New("user not exists")
116114}
117115
118116/* DAILY DEVIATIONS */
@@ -157,7 +155,7 @@ func SearchFunc(query string, page int, scope rune, user ...string) (ss Search,
157155 }
158156 url.WriteString("&type=gallery&order=most-recent&init=true&limit=50&q=")
159157 } else {
160 e = errors.New("Missing username (last argument)")
158 e = errors.New("missing username (last argument)")
161159 return
162160 }
163161 default:
user-group.go +44 −36
@@ -6,6 +6,38 @@ import (
66)
77
88// структура группы или пользователя
9type groups struct {
10 GroupAbout struct {
11 FoundatedAt time `json:"foundationTs"`
12 Description Text
13 }
14 GroupAdmins struct {
15 Results []struct {
16 Username string
17 }
18 }
19}
20
21type About struct {
22 Country, Website, WebsiteLabel, Gender string
23 RegDate int64 `json:"deviantFor"`
24 Description Text `json:"textContent"`
25
26 SocialLinks []struct {
27 Value string
28 }
29 Interests []struct {
30 Label, Value string
31 }
32}
33
34type users struct {
35 About About
36 CoverDeviation struct {
37 Deviation Deviation `json:"coverDeviation"`
38 }
39}
40
941type GRuser struct {
1042 ErrorDescription string
1143 Owner struct {
@@ -18,32 +50,10 @@ type GRuser struct {
1850 Modules []struct {
1951 Name string
2052 ModuleData struct {
21 About struct {
22 Country, Website, WebsiteLabel, Gender, Tagline string
23 DeviantFor int64
24 SocialLinks []struct {
25 Value string
26 }
27 TextContent text
28 Interests []struct {
29 Label, Value string
30 }
31 }
32 CoverDeviation struct {
33 Deviation Deviation `json:"coverDeviation"`
34 }
53 groups
54 users
3555
3656 // группы
37 GroupAbout struct {
38 Tagline string
39 CreatinDate time `json:"foundationTs"`
40 Description text
41 }
42 GroupAdmins struct {
43 Results []struct {
44 Username string
45 }
46 }
4757 Folders struct {
4858 Results []struct {
4959 FolderId int
@@ -52,24 +62,22 @@ type GRuser struct {
5262 }
5363
5464 // галерея
55 ModuleData struct {
56 Folder struct {
57 Username string
58 Pages int `json:"totalPageCount"`
59 Deviations []Deviation
60 } `json:"folderDeviations"`
61 }
65 Folder struct {
66 Username string
67 Pages int `json:"totalPageCount"`
68 Deviations []Deviation
69 } `json:"folderDeviations"`
6270 }
6371 }
6472 }
6573 }
66 PageExtraData struct {
67 GruserTagline string
68 Stats struct {
74 Extra struct {
75 Tag string `json:"gruserTagline"`
76 Stats struct {
6977 Deviations, Watchers, Watching, Pageviews, CommentsMade, Favourites, Friends int
7078 FeedComments int `json:"commentsReceivedProfile"`
7179 }
72 }
80 } `json:"pageExtraData"`
7381}
7482
7583type Group struct {
@@ -78,7 +86,7 @@ type Group struct {
7886}
7987
8088// подходит как группа, так и пользователь
81func (s Group) GroupFunc() (g Group) {
89func (s Group) GroupFunc() (g GRuser) {
8290 ujson("dauserprofile/init/about?username="+s.Name, &g)
8391
8492 return