//static bool cekBedaStr(string data,string data2) //{ // try { // Regex r = new Regex("<title>(.*?)</title>", RegexOptions.IgnoreCase); // Match m = r.Match(data); // Match m2 = r.Match(data2); // if (string.Compare(m.Groups[1].Value, m2.Groups[1].Value) != 0) return true; // else return false; // } // catch // { // return false; // } //} static void Main(string[] args) { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; Console.Title = "Webtoons Downloader by RieqyNS13 (fb.me/rieqyns13) "; string url; Console.ForegroundColor = ConsoleColor.Green; Console.Write("[+] Masukkan url (contoh: http://www.webtoons.com/id/fantasy/noblesse/list?title_no=442 ) = "); url = Console.ReadLine().Trim(); url = Regex.Replace(url, "&?page=\\d*", string.Empty); string error = null; cookie = new CookieContainer(); string curl = getTextFromSteam(get(url, ref error)); if (curl == null) { if (responCode == HttpStatusCode.NotFound) { Console.WriteLine("[+] Not Found anjing"); } else { Console.WriteLine("[+] Koneksi cacat njing " + responCode.ToString()); } Console.Read(); return; } Gay bacod = getListChapter(url); Console.WriteLine("[+] Jumlah chapter : " + bacod.listUrl.Count); Console.ForegroundColor = ConsoleColor.Cyan; if (bacod.listUrl.Count == 0) { Console.WriteLine("[+] Kosong cuk"); Console.Read(); return; } else { Console.WriteLine(); for (int i = 0; i < bacod.listUrl.Count; i++) { Console.WriteLine("[" + i + "] " + bacod.listJudul[i]); } Console.WriteLine(); } Console.ForegroundColor = ConsoleColor.Green; string range; int begin = 0, end = 0; do { Console.Write("[+] Range chapter yang didownload (contoh: 0-11) = "); range = Console.ReadLine(); } while (!cekInputRange(bacod.listUrl, range, ref begin, ref end)); do { Console.Write("[+] Tulis folder untuk menyimpan manga (contoh: f:\\manga) = "); foldersimpan = Console.ReadLine().Trim(); } while (!Directory.Exists(foldersimpan.Trim())); string timpa; do { Console.Write("[+] Timpa file yang sudah ada ? [y/n] = "); timpa = Console.ReadLine().Trim().ToLower(); } while (timpa != "y" && timpa != "n"); proses(bacod.listUrl, bacod.listJudul, begin, end, timpa == "y" ? true : false); Console.Read(); }
static void Main() { Gay gay = new Gay(); }
static Gay getListChapter(string url) { Gay gay = new Gay(); bool next = true; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[+] Proses Mengumpulkan list chapter : "); string error = null; string page = "1"; string curl = getTextFromSteam(get(url + "&page=" + page, ref error)); while (next) { Match getpage = Regex.Match(curl, "<span class='on'>(.*?)</span>", RegexOptions.IgnoreCase | RegexOptions.Singleline); page = getpage.Groups[1].Value; Console.WriteLine("> " + url); //Console.ReadKey(); Match x = Regex.Match(curl, "<ul id=\"_listUl\">\\s*(.*?)\\s*</ul>", RegexOptions.IgnoreCase | RegexOptions.Singleline); string asu = null; if (x.Groups.Count == 2) { asu = x.Groups[1].Value; MatchCollection matches = Regex.Matches(asu, "<li id=\".*?\" data-episode-no=\".*?\">\\s+<a href=\"(.*?)\"", RegexOptions.IgnoreCase); string[] jancuk = new string[matches.Count]; MatchCollection matches2 = Regex.Matches(asu, "<span class=\"subj\"><span>(.*?)</span>", RegexOptions.IgnoreCase); if (matches.Count == matches2.Count * 3) { for (int i = 0; i < matches2.Count; i++) { jancuk[i] = matches[i * 3].Groups[1].Value; } } else { for (int i = 0; i < matches.Count; i++) { jancuk[i] = matches[i].Groups[1].Value; } } for (int j = 0; j < matches2.Count; j++) { gay.listUrl.Add(jancuk[j]); gay.listJudul.Add(matches2[j].Groups[1].Value); } } Match getnextpage = Regex.Match(curl, "<span class='on'>.+?</span></a>\\s+<a href=\"(.+?)\"", RegexOptions.IgnoreCase); if (getnextpage.Success) { page = getnextpage.Groups[1].Value; Uri uri = new Uri(url); url = uri.Scheme + "://" + uri.Host + page; curl = getTextFromSteam(get(url, ref error)); } else { next = false; } } Console.ForegroundColor = ConsoleColor.Green; string[] urls = new string[gay.listUrl.Count]; string[] text = new string[gay.listJudul.Count]; for (int i = 0; i < gay.listUrl.Count; i++) { urls[i] = gay.listUrl[gay.listUrl.Count - 1 - i]; text[i] = gay.listJudul[gay.listJudul.Count - 1 - i]; } gay.listUrl = urls.ToList(); gay.listJudul = text.ToList(); return(gay); }
static Gay getListChapter(string url) { Gay gay = new Gay(); bool next = true; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[+] Proses Mengumpulkan list chapter : "); string error = null; int page = 1; string curl = getTextFromSteam(get(url + "&page=" + page, ref error)); do { Console.WriteLine("> " + url + "&page" + page); Match x = Regex.Match(curl, "<ul id=\"_listUl\">\\s*(.*?)\\s*</ul>", RegexOptions.IgnoreCase | RegexOptions.Singleline); string asu = null; if (x.Groups.Count == 2) { asu = x.Groups[1].Value; MatchCollection matches = Regex.Matches(asu, "<a href=\"(.*?)\"", RegexOptions.IgnoreCase); string[] jancuk = new string[matches.Count]; MatchCollection matches2 = Regex.Matches(asu, "<span class=\"subj\"><span>(.*?)</span>", RegexOptions.IgnoreCase); if (matches.Count == matches2.Count * 3) { for (int i = 0; i < matches2.Count; i++) { jancuk[i] = matches[i * 3].Groups[1].Value; } } else { for (int i = 0; i < matches.Count; i++) { jancuk[i] = matches[i].Groups[1].Value; } } for (int j = 0; j < matches2.Count; j++) { gay.listUrl.Add(jancuk[j]); gay.listJudul.Add(matches2[j].Groups[1].Value); } } string tmp = getTextFromSteam(get(url + "&page=" + (++page), ref error)); if (cekBedaStr(tmp, curl)) { curl = tmp; } else { next = false; } } while (next); Console.ForegroundColor = ConsoleColor.Green; string[] urls = new string[gay.listUrl.Count]; string[] text = new string[gay.listJudul.Count]; for (int i = 0; i < gay.listUrl.Count; i++) { urls[i] = gay.listUrl[gay.listUrl.Count - 1 - i]; text[i] = gay.listJudul[gay.listJudul.Count - 1 - i]; } gay.listUrl = urls.ToList(); gay.listJudul = text.ToList(); return(gay); }