public override void load_all_mangas()
        {
            allManga = new List <KeyValuePair <String, String> >();

            for (int i = -1; i < 26; ++i)
            {
                String tmp_link = link_list_manga;
                if (i >= 0)
                {
                    tmp_link = tmp_link + "/" + Convert.ToChar('a' + i);
                }

                String[] content = HtmlRequest.get_html(tmp_link);
                if (content == null)
                {
                    allManga = null;
                    return;
                }

                foreach (String j in content)
                {
                    if (j.IndexOf("<span class=\"manga-item\">") != -1)
                    {
                        String str = HtmlRequest.cut_str(j, "<span class=\"icon-dot\"></span>", "</a>");

                        String link = HtmlRequest.cut_str(str, "<a href=\"", "\">");
                        String name = str.Substring(str.IndexOf("\">") + 2);
                        allManga.Add(new KeyValuePair <String, String>(name, link));
                    }
                }
            }
            this.createFile();
        }
        public override List <String> prepareDownload(Chapters chapitre)
        {
            String link = chapitre.getLink();

            string[] content = HtmlRequest.get_html(link);
            int      nb_page = 0;

            List <String> listlinkPage = new List <string>();

            int nb_list = 0;

            foreach (String i in content)
            {
                if (i.IndexOf("<select name=\"category_type\" class=\"form-control input-sm jump-menu\">") != -1)
                {
                    nb_list++;
                }

                if (i.IndexOf("<option value=\"") != -1 && nb_list == 2)
                {
                    if (nb_page > 0)
                    {
                        listlinkPage.Add(HtmlRequest.cut_str(i, "value=\"", "\">"));
                    }
                    else
                    {
                        listlinkPage.Add(HtmlRequest.cut_str(i, "value=\"", "\" selected"));
                    }
                    nb_page++;
                }
            }
            chapitre.setMax(nb_page);
            return(listlinkPage);
        }
        public override void load_all_mangas()
        {
            allManga = new List <KeyValuePair <String, String> >();

            String[] content = HtmlRequest.get_html(link_list_manga);

            if (content == null)
            {
                allManga = null;
                return;
            }

            foreach (String i in content)
            {
                String[] stringSeparators = new String[] { "</li><li>" };
                if (i.IndexOf("<li><a class=\"manga_info\" rel=\"") != -1)
                {
                    String[] manga;
                    manga = i.Split(stringSeparators, StringSplitOptions.None);
                    foreach (String m in manga)
                    {
                        String name = HtmlRequest.cut_str(m, "rel=\"", "\" href=").Replace("&quot;", "\"").Replace("&amp;", "&");
                        String link = HtmlRequest.cut_str(m, "\" href=\"", "\"><span>");
                        allManga.Add(new KeyValuePair <String, String>(name, link));
                    }
                }
            }
            this.createFile();
        }
        public override List <String> prepareDownload(Chapters chapitre)
        {
            String link = chapitre.getLink();

            string[] content = HtmlRequest.get_html(link);
            int      nb_page = 0;

            List <String> listlinkPage = new List <string>();

            foreach (String i in content)
            {
                if (i.IndexOf("<option value=\"") != -1)
                {
                    if (nb_page > 0)
                    {
                        listlinkPage.Add("http://www.mangareader.net" + HtmlRequest.cut_str(i, "value=\"", "\">"));
                    }
                    else
                    {
                        listlinkPage.Add("http://www.mangareader.net" + HtmlRequest.cut_str(i, "value=\"", "\" selected"));
                    }
                    nb_page++;
                }
            }
            chapitre.setMax(nb_page);
            return(listlinkPage);
        }
 public override void downloadScan(String link, int nb_page, Chapters chapitre, String path)
 {
     string[] content2 = HtmlRequest.get_html(link);
     foreach (String j in content2)
     {
         if (j.IndexOf("class=\"img-responsive\"") != -1)
         {
             MyPage p = new MyPage(nb_page, chapitre.getMax(), HtmlRequest.cut_str(j, "src=\"", "?u=\" class="), chapitre.getNumber(), chapitre.isChapter());
             p.download(path);
             p = null;
         }
     }
 }
 static public void save_image(String link, String path, int nb_try = 0)
 {
     try
     {
         Debug.WriteLine(link);
         using (WebClient client = new WebClient())
         {
             client.DownloadFile(new Uri(link), @path);
         }
     } catch (WebException we)
     {
         Debug.WriteLine("Fail " + link);
         if (nb_try < 3)
         {
             HtmlRequest.save_image(link, path, nb_try + 1);
         }
     }
 }
        public override void load_all_mangas()
        {
            allManga = new List <KeyValuePair <String, String> >();

            String[] content  = HtmlRequest.get_html(link_list_manga);
            int      is_start = 0;

            if (content == null)
            {
                allManga = null;
                return;
            }

            foreach (String i in content)
            {
                if (i.IndexOf("<div class=\"series_col\"><a name=\" \"></a>") != -1)
                {
                    is_start = 1;
                }

                if (i.IndexOf("<li><b>Network</b></li>") != -1)
                {
                    is_start = 0;
                }

                if (i.IndexOf("<li><a href=\"/") != -1 && is_start == 1)
                {
                    String str;
                    if (i.IndexOf("<ul class=\"series_alpha\">") != -1)
                    {
                        str = i.Substring(25);
                    }
                    else
                    {
                        str = i;
                    }

                    String name = HtmlRequest.cut_str(str, "\">", "</a>");
                    String link = HtmlRequest.cut_str(str, "<li><a href=\"", "\">");
                    allManga.Add(new KeyValuePair <String, String>(name, "http://www.mangareader.net" + link));
                }
            }
            this.createFile();
        }
Example #8
0
        public override List <String> prepareDownload(Chapters chapitre)
        {
            String link = chapitre.getLink();

            string[] content = HtmlRequest.get_html(link);
            int      nb_page = 0;

            List <String> listlinkPage = new List <string>();

            foreach (String i2 in content)
            {
                String i = i2.Replace("\t", "");
                if (i.IndexOf("data-img") != -1 && i.IndexOf("data-img=\"IMG__") == -1 && i.IndexOf("__Add__") == -1)
                {
                    listlinkPage.Add("http://www.japscan.com" + HtmlRequest.cut_str(i, "value=\"", "\">"));
                    nb_page++;
                }
            }
            chapitre.setMax(nb_page);
            return(listlinkPage);
        }
Example #9
0
 public override void downloadScan(String link, int nb_page, Chapters chapitre, String path)
 {
     string[] content = HtmlRequest.get_html(link);
     foreach (String j2 in content)
     {
         String j = j2.Replace("\t", "");
         if (j.IndexOf("itemprop=\"image\"") != -1)
         {
             MyPage p = new MyPage(nb_page, chapitre.getMax(), HtmlRequest.cut_str(j, "src=\"", "\" />"), chapitre.getNumber(), chapitre.isChapter());
             if (p.link == "NOT FOUND")
             {
                 p = new MyPage(nb_page, chapitre.getMax(), HtmlRequest.cut_str(j, "src=\"", "\"/>"), chapitre.getNumber(), chapitre.isChapter());
                 if (p.link == "NOT FOUND")
                 {
                     throw new Exception();
                 }
             }
             p.download(path);
             p = null;
         }
     }
 }
        public override void downloadScan(String link, int nb_page, Chapters chapitre, String path)
        {
            string[] content2 = HtmlRequest.get_html(link);
            int      reset    = 0;

            while (content2.Length < 75 && reset < 5)
            {
                System.Threading.Thread.Sleep(1000);
                content2 = null;
                content2 = HtmlRequest.get_html(link);
                reset++;
            }
            foreach (String j in content2)
            {
                if (j.IndexOf("id=\"image\"") != -1)
                {
                    MyPage p = new MyPage(nb_page, chapitre.getMax(), HtmlRequest.cut_str(j, "src=\"", "\" onload="), chapitre.getNumber(), chapitre.isChapter());
                    p.download(path);
                    p = null;
                }
            }
        }
Example #11
0
        public override void load_all_mangas()
        {
            allManga = new List <KeyValuePair <String, String> >();

            string[] content = HtmlRequest.get_html(link_list_manga);

            if (content == null)
            {
                allManga = null;
                return;
            }

            foreach (String i2 in content)
            {
                String i = i2.Replace("\t", "");
                if (i.IndexOf("<div class=\"cell\"><a href=\"/mangas/") != -1 && i.IndexOf("blackout") == -1)
                {
                    String name = HtmlRequest.cut_str(i, "/\">", "</a></div>");
                    String link = HtmlRequest.cut_str(i, "<a href=\"", "/\">");
                    allManga.Add(new KeyValuePair <String, String>(name, "http://www.japscan.com" + link + "/"));
                }
            }
            this.createFile();
        }
        public override void load_chapters(KeyValuePair <String, String> infos)
        {
            String[] html = HtmlRequest.get_html(infos.Value);

            List <String[]> array_positions = new List <string[]>();
            int             found;
            int             found2;
            int             found3;

            name = infos.Key;
            link = infos.Value;

            int nb_cell  = 0;
            int synopsis = 0;

            list_chapter.Clear();

            Tome current_tome = null;
            int  index        = 0;

            foreach (String i2 in html)
            {
                String i = i2.Replace("\t", "");
                found  = i.IndexOf("<a href=\"//www.japscan.com/lecture-en-ligne/");
                found2 = i.IndexOf("<h2>Volume");
                found3 = i.IndexOf("<div class=\"cell\">");

                if (found3 == 0)
                {
                    nb_cell++;
                }

                if (found3 == 0 && nb_cell == 6)
                {
                    auteur = i.Substring(18, i.Length - 24);
                }

                if (found3 == 0 && nb_cell == 7)
                {
                    année = i.Substring(18, i.Length - 24);
                }

                if (synopsis == 1)
                {
                    resumé   = i.Substring(0, i.Length - 6);
                    synopsis = 0;
                }

                if (i.IndexOf("<div id=\"synopsis\">") == 0)
                {
                    synopsis = 1;
                }

                if (found == 0)
                {
                    int end_pos = i.IndexOf("/\">");

                    String link = i.Substring(11, end_pos - 11);
                    String desc = i.Substring(end_pos + 3, i.Length - end_pos - 7);

                    String desc_det;
                    String title = null;

                    if (current_tome != null && i.IndexOf("Tome " + current_tome.getNumber()) != -1)
                    {
                        list_chapter.Add(new Chapters(index, false, current_tome.getNumber(), "http://" + link + "/", current_tome, title, null));
                    }
                    else
                    {
                        if (desc.Substring(desc.IndexOf(name) + name.Length).IndexOf(":") != -1)
                        {
                            desc_det = desc.Substring(desc.IndexOf(name) + name.Length, desc.IndexOf(":") - (desc.IndexOf(name) + name.Length));
                            title    = desc.Substring(desc.IndexOf(": ") + 2, desc.Length - (desc.IndexOf(": ") + 2));
                        }
                        else
                        {
                            desc_det = desc.Substring(desc.IndexOf(name) + name.Length, desc.Length - (desc.IndexOf(name) + name.Length));
                        }

                        Double number = TryParseDouble(desc_det);

                        list_chapter.Add(new Chapters(index, true, number, "http://" + link + "/", current_tome, title, null));

                        index++;
                    }
                }
                else if (found2 == 0)
                {
                    String data = i.Substring(i.IndexOf("<h2>") + 4);
                    data = data.Substring(0, data.IndexOf("</h2>"));

                    String nb_tome = Regex.Match(data, @"\d+").Value;

                    int    pos_sep = data.IndexOf(":");
                    String title;
                    if (pos_sep != -1)
                    {
                        title = data.Substring(pos_sep + 2);
                    }
                    else
                    {
                        title = null;
                    }

                    current_tome = new Tome(title, Int32.Parse(nb_tome));
                }
            }
        }
        public override void load_chapters(KeyValuePair <String, String> infos)
        {
            String[] html = HtmlRequest.get_html(infos.Value);

            List <Chapters> array_positions = new List <Chapters>();

            name = infos.Key;
            link = infos.Value;

            list_chapter.Clear();

            int synopsis = 0;
            int author   = 0;
            int chapter  = 0;
            int picture  = 0;

            String tmp_link = "";

            int index     = 0;
            int next_line = 0;

            Double tmp_number = 0;

            Chapters tmp_chapter = null;

            foreach (String i in html)
            {
                if (synopsis == 1)
                {
                    synopsis = 0;
                    resumé   = HtmlRequest.cut_str(i, "\">", "</span></p>");
                    if (resumé == "NOT FOUND")
                    {
                        resumé = HtmlRequest.cut_str(i, "<p>", "</p>");
                    }
                    if (resumé == "NOT FOUND")
                    {
                        resumé = "";
                    }
                }

                if (i.IndexOf("<li class=\"list-group-item movie-detail\">") != -1)
                {
                    synopsis = 1;
                }

                if (author == 1 && i.IndexOf("<li><a href=\"") != -1)
                {
                    author = 0;
                    auteur = HtmlRequest.cut_str(i, "\">", "</a></li>");
                }

                if (i.IndexOf("<ul class=\"cast-list clearfix\">") != -1)
                {
                    author = 1;
                }

                if (picture == 1 && i.IndexOf("<img src=\"") != -1)
                {
                    picture  = 0;
                    img_link = HtmlRequest.cut_str(i, "<img src=\"", "\" alt=\"");
                }

                if (i.IndexOf("<div class=\"col-md-3\">") != -1)
                {
                    picture = 1;
                }

                if (i.IndexOf("<ul class=\"chp_lst\">") != -1)
                {
                    chapter = 1;
                }

                if (i.IndexOf("<a href=\"") != -1 && chapter == 1)
                {
                    tmp_link = HtmlRequest.cut_str(i, "<a href=\"", "\">");
                }

                if (next_line == 1)
                {
                    next_line = 0;
                    if (tmp_number != -666)
                    {
                        tmp_chapter.date = HtmlRequest.cut_str(i, "\"> ", "</span>");
                        list_chapter.Add(tmp_chapter);
                    }
                }

                if (i.IndexOf("<span class=\"val\"><span class=\"icon-arrow-2\"></span>") != -1)
                {
                    String desc = HtmlRequest.cut_str(i, "\"></span>", " </span>");
                    if (desc == "NOT FOUND")
                    {
                        desc = i.Substring(i.IndexOf("\"></span>") + 9);
                    }

                    tmp_number = TryParseDouble(desc.Substring(name.Length + 3));

                    if (tmp_number != -666)
                    {
                        tmp_chapter = new Chapters(index, true, tmp_number, tmp_link + "/", null, null, null);
                        index++;
                    }
                    next_line = 1;
                }
            }
            nb_tomes = 0;
        }
Example #14
0
        public override void load_chapters(KeyValuePair <String, String> infos)
        {
            String[] html = HtmlRequest.get_html(infos.Value);

            List <Chapters> array_positions = new List <Chapters>();

            this.name = infos.Key;
            this.link = infos.Value;

            list_chapter.Clear();
            int is_chapter_list = 0;
            int is_start        = 0;

            String[] tab;

            String link = "";
            String desc;

            int img      = 0;
            int cpt_desc = 0;

            resumé = "";
            int      index           = 0;
            Tome     current_tome    = null;
            Chapters current_chapter = null;

            foreach (String i in html)
            {
                if (i.IndexOf("has been licensed") != -1)
                {
                    list_chapter.Add(new Chapters(-1, false, 0, "", null, "Manga has been licensed", null));
                }

                if (i.IndexOf("<div class=\"detail_list\">") != -1)
                {
                    is_chapter_list = 1;
                }

                if (i.IndexOf("<a class=\"color_0077\"") != -1 && is_chapter_list == 1)
                {
                    is_start        = 1;
                    current_chapter = new Chapters();
                    link            = HtmlRequest.cut_str(i, "href=\"", "\" >");
                    if (link == "NOT FOUND")
                    {
                        link = HtmlRequest.cut_str(i, "href=\"", "\" name");
                    }
                    current_chapter.setLink(link);
                    current_chapter.SetisChapter(true);
                }
                if (i.IndexOf("</a>") != -1 && is_start == 1)
                {
                    desc = i.Substring(0, i.IndexOf("</a>"));

                    current_chapter.setNumber(TryParseDouble(desc.Replace(name, "")));
                }

                if (i.IndexOf("<span class=\"mr6\"") != -1 && is_start == 1)
                {
                    int tome_nb = 0;
                    if (i.IndexOf("Vol ") != -1)
                    {
                        tome_nb = Int32.Parse(HtmlRequest.cut_str(i, "Vol ", "</span>"));
                    }

                    if (current_tome == null || current_tome.getNumber() != tome_nb)
                    {
                        current_tome = new Tome(null, tome_nb);
                    }

                    current_chapter.setTome(current_tome);
                }

                if (i.IndexOf("<span class=\"right\">") != -1 && is_start == 1)
                {
                    is_start = 0;

                    current_chapter.setIndex(index);
                    current_chapter.date = HtmlRequest.cut_str(i, "<span class=\"right\">", "</span>");
                    index++;

                    list_chapter.Add(current_chapter);
                }

                if (i.IndexOf("class=\"tab_comment clearfix\">") != -1 && is_chapter_list == 1)
                {
                    is_chapter_list = 0;
                }

                if (i.IndexOf("<li><label>Author(s):</label>") != -1)
                {
                    auteur = HtmlRequest.cut_str(i, "\">", "</a></li>");
                }

                if (img == 1)
                {
                    img_link = HtmlRequest.cut_str(i, "<img src=\"", "\" onerror");
                    img      = 0;
                }

                if (i.IndexOf("<div class=\"manga_detail_top clearfix\">") != -1)
                {
                    img = 1;
                }

                if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1)
                {
                    cpt_desc = 1;
                }


                if (cpt_desc == 1)
                {
                    if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1 && i.IndexOf("&nbsp;<a href=") != -1)
                    {
                        resumé = HtmlRequest.cut_str(i, "style=\"display:none;\">", "&nbsp;<a href=");
                    }
                    else if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1)
                    {
                        int pos = i.IndexOf("<p id=\"show\" style=\"display:none;\">") + 35;
                        resumé += i.Substring(pos, i.Length - pos);
                    }
                    else if (i.IndexOf("&nbsp;<a href=") != -1)
                    {
                        resumé += i.Substring(0, i.IndexOf("&nbsp;<a href="));
                    }
                    else
                    {
                        resumé += i;
                    }
                }

                if (i.IndexOf("&nbsp;<a href=") != -1 && cpt_desc == 1)
                {
                    cpt_desc = 0;
                }
            }
            resumé   = resumé.Replace("&quot;", "\"");
            nb_tomes = 0;
        }
Example #15
0
        public override void load_chapters(KeyValuePair <String, String> infos)
        {
            String[] html = HtmlRequest.get_html(infos.Value);

            int found;

            name = infos.Key;
            link = infos.Value;

            list_chapter.Clear();
            int is_start      = 0;
            int is_line_start = 0;

            int det   = 0;
            int index = 0;

            Double tmp_number = 0;
            String tmp_link   = "";
            String tmp_title  = "";

            foreach (String i in html)
            {
                found = i.IndexOf("<a href=\"/");

                if (det == 1)
                {
                    année = HtmlRequest.cut_str(i, "<td>", "</td>");
                    det   = 0;
                }

                if (det == 2)
                {
                    auteur = HtmlRequest.cut_str(i, "<td>", "</td>");
                    det    = 0;
                }

                if (i.IndexOf("<td class=\"propertytitle\">Year of Release:</td>") == 0)
                {
                    det = 1;
                }

                if (i.IndexOf("<td class=\"propertytitle\">Author:</td>") == 0)
                {
                    det = 2;
                }

                if (i.IndexOf("<th class=\"leftgap\">Chapter Name</th>") != -1)
                {
                    is_start = 1;
                }

                if (i.IndexOf("<a href=\"") != -1 && is_start == 1)
                {
                    is_line_start = 1;
                }

                if (i.IndexOf("<div class=\"clear\"></div>") != -1 && is_start == 1)
                {
                    is_start = 0;
                }

                if (i.IndexOf("<div id=\"mangaimg\">") == 0)
                {
                    img_link = HtmlRequest.cut_str(i, "<div id=\"mangaimg\"><img src=\"", "\" alt=");
                }

                if (found == 0 && is_start == 1)
                {
                    String link = HtmlRequest.cut_str(i, "<a href=\"", "\">");
                    String desc = HtmlRequest.cut_str(i, "\">", "</a>") + " : " + HtmlRequest.cut_str(i, "</a> : ", "</td>");

                    tmp_number = TryParseDouble(HtmlRequest.cut_str(i, "\">", "</a>").Substring(name.Length));

                    tmp_title = null;
                    if (desc.IndexOf(" : ") != -1)
                    {
                        tmp_title = HtmlRequest.cut_str(i, "</a> : ", "</td>");
                    }

                    tmp_link = "http://www.mangareader.net" + link + "/";
                }

                if (i.IndexOf("<td>") != -1 && is_line_start == 1)
                {
                    String date = HtmlRequest.cut_str(i, "<td>", "</td>");
                    list_chapter.Insert(0, new Chapters(index, true, tmp_number, tmp_link, null, tmp_title, date));
                    index++;
                    is_line_start = 0;
                }
            }
            nb_tomes = 0;
        }