示例#1
0
        public void StartDownloading()
        {
            File.Create(Path.Combine(chapter.GetChapterRoot().Parent.FullName, "dl" + chapter.GetID())).Close();
            string jsonUrl = "https://mangadex.org/api/chapter/" + chapter.GetID();
            string jsonString;

            using (var wc = new WebClient())
            {
                jsonString = wc.DownloadString(jsonUrl);
            }

            JObject jobj = JObject.Parse(jsonString);

            string server = (string)jobj["server"];
            string hash   = (string)jobj["hash"];

            // string[] page_array = /* ((string) */ jobj["page_array"]. /* ).Split(',') */;
            List <string>         page_array = new List <string>();
            IJEnumerable <JToken> jtokens    = jobj["page_array"].Values();

            foreach (JToken t in jtokens)
            {
                page_array.Add((string)t);
            }

            foreach (string file in page_array)
            {
                if (server == "/data/")
                {
                    server = "https://mangadex.org/data/";
                }

                string imgUrl = server + hash + "/" + file;

                FileInfo imgFile = new FileInfo(
                    Path.Combine(
                        chapter.GetChapterRoot().FullName,
                        ConvertToNumericFileName(file)
                        ));

                if (File.Exists(imgFile.FullName))
                {
                    if (imgFile.Length <= 0)
                    {
                        File.Delete(imgFile.FullName);
                    }
                }

                DownloadAsync(new Uri(imgUrl), imgFile.FullName);
            }
        }
        public void StartDownloading()
        {
            File.Create(Path.Combine(chapter.GetChapterRoot().Parent.FullName, "dl" + chapter.GetID())).Close();

            string mName = chapter.GetChapterRoot().Parent.Name;
            string cUrl  = "https://kissmanga.org/chapter/" + mName + "/" + chapter.GetID();

            string[] pageUrls = KissMangaHelper.GetPageUrls(cUrl);

            foreach (string url in pageUrls)
            {
                string imgFile = Path.Combine(chapter.GetChapterRoot().FullName, KissMangaHelper.GetPageFileName(url));
                DownloadAsync(new Uri(url), imgFile);
            }
        }
示例#3
0
        public void StartDownloading()
        {
            File.Create(Path.Combine(chapter.GetChapterRoot().Parent.FullName, "dl" + chapter.GetID())).Close();
            List <HtmlDocument> docs = new List <HtmlDocument>();
            int pageCount            = Nhentai.GetPageCount("https://nhentai.net/g/" + chapter.GetID());

            string hUrl = "https://nhentai.net/g/" + chapter.GetID() + "/";

            string baseUrl = Nhentai.GetImageUrl(hUrl + "1");
            string hash    = Nhentai.GetHash(baseUrl);

            for (int page = 1; page <= pageCount; page++)
            {
                string imgUrl  = Nhentai.ImgBase() + hash + "/" + page + "." + Nhentai.GetExt(baseUrl);
                string imgFile = Path.Combine(chapter.GetChapterRoot().FullName, page + "." + Nhentai.GetExt(baseUrl));
                DownloadAsync(new Uri(imgUrl), imgFile);
            }
        }