From dcce260b67098ada1eee44a2128a904aed2a197e Mon Sep 17 00:00:00 2001 From: AlexZorzi Date: Fri, 26 Mar 2021 18:36:18 +0100 Subject: [PATCH] push files --- MangaWorldApi.md | 129 +++++++++++++++++++++++++++++++++++++ README.md | 29 +++++++++ chapter.go | 10 +++ commonLogic.go | 32 +++++++++ cred.go | 6 ++ download.go | 164 +++++++++++++++++++++++++++++++++++++++++++++++ main.go | 141 ++++++++++++++++++++++++++++++++++++++++ manga.go | 115 +++++++++++++++++++++++++++++++++ pages.go | 9 +++ volume.go | 9 +++ 10 files changed, 644 insertions(+) create mode 100644 MangaWorldApi.md create mode 100644 README.md create mode 100644 chapter.go create mode 100644 commonLogic.go create mode 100644 cred.go create mode 100644 download.go create mode 100644 main.go create mode 100644 manga.go create mode 100644 pages.go create mode 100644 volume.go diff --git a/MangaWorldApi.md b/MangaWorldApi.md new file mode 100644 index 0000000..4e8de30 --- /dev/null +++ b/MangaWorldApi.md @@ -0,0 +1,129 @@ +# Pagina Archivio +Json Sono caricati in pagina tra '.concat(' & ') \") + data := []byte(jsondata) + return data +} + +func GetLatestMangaIndex() int64 { + url := "https://www.mangaworld.cc/" + var latest int64 + for { + resp, err := GetWebPage(url) + data := bufToJson(resp) + latestMangaTemp, err := jsonparser.GetInt(data, "o", "w", "[1]", "[2]", "globalData", "latestMangas", "[0]", "linkId") + if err != nil { + //println("CloudFlare Error refreshing proxy") + //ChangeProxy() + println("CloudFlare Error refreshing cookie") + ChangeCookie() + ChangeUserAgent() + SaveCookies() + } else { + latest = latestMangaTemp + break + } + } + return latest +} + +func GetManga(ID int) (Manga, error) { + url := "https://www.mangaworld.cc/manga/" + strconv.Itoa(ID) + var mangadata []byte + var readdata []byte + for { + resp, err := GetWebPage(url) + if resp.StatusCode == 404 { + return Manga{}, errors.New("Error 404 skip of ID") + } + data := bufToJson(resp) + mangadataTemp, _, _, err := jsonparser.Get(data, "o", "w", "[0]", "[2]", "manga") + readdataTemp, _, _, err2 := jsonparser.Get(data, "o", "w", "[3]", "[2]", "pages") + if err2 != nil { + readdataTemp, _, _, err2 = jsonparser.Get(data, "o", "w", "[4]", "[2]", "pages") + } + if err != nil && err2 != nil { + //println("CloudFlare Error refreshing proxy") + //ChangeProxy() + println(url) + println("CloudFlare Error refreshing cookie") + ChangeCookie() + ChangeUserAgent() + SaveCookies() + } else { + mangadata = mangadataTemp + readdata = readdataTemp + break + } + } + var manga Manga + json.Unmarshal(mangadata, &manga) + + var pages Pages + json.Unmarshal(readdata, &pages) + + manga.Pages = pages + return manga, nil +} diff --git a/pages.go b/pages.go new file mode 100644 index 0000000..3dbe6fd --- /dev/null +++ b/pages.go @@ -0,0 +1,9 @@ +package main + +type Pages struct { + Volumes []struct { + Volume Volume `json:"volume"` + Chapters []Chapter `json:"chapters"` + } `json:"volumes"` + SingleChapters []Chapter `json:"singleChapters"` +} diff --git a/volume.go b/volume.go new file mode 100644 index 0000000..9887b74 --- /dev/null +++ b/volume.go @@ -0,0 +1,9 @@ +package main + +type Volume struct { + ID string `json:"_id"` + Manga string `json:"manga"` + Name string `json:"name"` + Slug string `json:"slugFolder"` + Image string `json:"image"` +}