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"` +}