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 { |
| 23 | 23 | Desctiption string |
| 24 | 24 | Comment string |
| 25 | 25 | |
| 26 | | TextContent text |
| 26 | TextContent Text |
| 27 | 27 | |
| 28 | 28 | User struct { |
| 29 | 29 | Username string |
deviantion.go
+6 −6
| @@ -35,21 +35,21 @@ type Deviation struct { |
| 35 | 35 | Stats struct { |
| 36 | 36 | Favourites, Views, Downloads int |
| 37 | 37 | } |
| 38 | | Media media |
| 38 | Media Media |
| 39 | 39 | Extended struct { |
| 40 | 40 | Tags []struct { |
| 41 | 41 | Name string |
| 42 | 42 | } |
| 43 | | DescriptionText text |
| 43 | DescriptionText Text |
| 44 | 44 | RelatedContent []struct { |
| 45 | 45 | Deviations []Deviation |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | | TextContent text |
| 48 | TextContent Text |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // её выпердыши |
| 52 | | type media struct { |
| 52 | type Media struct { |
| 53 | 53 | BaseUri string |
| 54 | 54 | Token []string |
| 55 | 55 | Types []struct { |
| @@ -58,7 +58,7 @@ type media struct { |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | | type text struct { |
| 61 | type Text struct { |
| 62 | 62 | Excerpt string |
| 63 | 63 | Html struct { |
| 64 | 64 | Markup, Type string |
| @@ -83,7 +83,7 @@ type Post struct { |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // преобразование урла в правильный |
| 86 | | func UrlFromMedia(m media) string { |
| 86 | func UrlFromMedia(m Media) string { |
| 87 | 87 | var url strings.Builder |
| 88 | 88 | for _, t := range m.Types { |
| 89 | 89 | if t.T == "fullview" { |
misc.go
+8 −10
| @@ -48,14 +48,12 @@ func request(uri string, other ...string) reqrt { |
| 48 | 48 | req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0.0") |
| 49 | 49 | |
| 50 | 50 | // куки и 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) |
| 59 | 57 | } |
| 60 | 58 | } |
| 61 | 59 | |
| @@ -112,7 +110,7 @@ func AEmedia(name string, t rune) (string, error) { |
| 112 | 110 | } |
| 113 | 111 | } |
| 114 | 112 | |
| 115 | | return "", errors.New("User not exists") |
| 113 | return "", errors.New("user not exists") |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | 116 | /* DAILY DEVIATIONS */ |
| @@ -157,7 +155,7 @@ func SearchFunc(query string, page int, scope rune, user ...string) (ss Search, |
| 157 | 155 | } |
| 158 | 156 | url.WriteString("&type=gallery&order=most-recent&init=true&limit=50&q=") |
| 159 | 157 | } else { |
| 160 | | e = errors.New("Missing username (last argument)") |
| 158 | e = errors.New("missing username (last argument)") |
| 161 | 159 | return |
| 162 | 160 | } |
| 163 | 161 | default: |
user-group.go
+44 −36
| @@ -6,6 +6,38 @@ import ( |
| 6 | 6 | ) |
| 7 | 7 | |
| 8 | 8 | // структура группы или пользователя |
| 9 | type 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 | |
| 21 | type 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 | |
| 34 | type users struct { |
| 35 | About About |
| 36 | CoverDeviation struct { |
| 37 | Deviation Deviation `json:"coverDeviation"` |
| 38 | } |
| 39 | } |
| 40 | |
| 9 | 41 | type GRuser struct { |
| 10 | 42 | ErrorDescription string |
| 11 | 43 | Owner struct { |
| @@ -18,32 +50,10 @@ type GRuser struct { |
| 18 | 50 | Modules []struct { |
| 19 | 51 | Name string |
| 20 | 52 | 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 |
| 35 | 55 | |
| 36 | 56 | // группы |
| 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 | | } |
| 47 | 57 | Folders struct { |
| 48 | 58 | Results []struct { |
| 49 | 59 | FolderId int |
| @@ -52,24 +62,22 @@ type GRuser struct { |
| 52 | 62 | } |
| 53 | 63 | |
| 54 | 64 | // галерея |
| 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"` |
| 62 | 70 | } |
| 63 | 71 | } |
| 64 | 72 | } |
| 65 | 73 | } |
| 66 | | PageExtraData struct { |
| 67 | | GruserTagline string |
| 68 | | Stats struct { |
| 74 | Extra struct { |
| 75 | Tag string `json:"gruserTagline"` |
| 76 | Stats struct { |
| 69 | 77 | Deviations, Watchers, Watching, Pageviews, CommentsMade, Favourites, Friends int |
| 70 | 78 | FeedComments int `json:"commentsReceivedProfile"` |
| 71 | 79 | } |
| 72 | | } |
| 80 | } `json:"pageExtraData"` |
| 73 | 81 | } |
| 74 | 82 | |
| 75 | 83 | type Group struct { |
| @@ -78,7 +86,7 @@ type Group struct { |
| 78 | 86 | } |
| 79 | 87 | |
| 80 | 88 | // подходит как группа, так и пользователь |
| 81 | | func (s Group) GroupFunc() (g Group) { |
| 89 | func (s Group) GroupFunc() (g GRuser) { |
| 82 | 90 | ujson("dauserprofile/init/about?username="+s.Name, &g) |
| 83 | 91 | |
| 84 | 92 | return |