コード例 #1
0
        private static void ParseDescriptionFromHTML(Movie movie, string html)
        {
            string parseDescription = html.Replace("<div class=\"description\" itemprop=\"description\">", "\0").
                                           Replace("</div> <!-- end description -->", "\0").
                                           Replace("<p>", "").
                                           Replace("</p>", "").
                                           Replace("<br />", "\n").
                                           Replace("</span>", "").
                                           Replace("<span>", "").
                                           Split('\0')[1];

            // Clear of span class tag //
            int idx = -1;
            do
            {
                idx = parseDescription.IndexOf("<span class=\"");
                if (idx != -1)
                {
                    int lastidx = parseDescription.IndexOf("\">");
                    parseDescription = parseDescription.Remove(idx, lastidx - idx + 2);
                }
            }
            while (idx != -1);

            // Clear of span title tag //
            idx = -1;
            do
            {
                idx = parseDescription.IndexOf("<span title=\"");
                if (idx != -1)
                {
                    int lastidx = parseDescription.IndexOf("\">");
                    parseDescription = parseDescription.Remove(idx, lastidx - idx + 2);
                }
            }
            while (idx != -1);
            movie.Description = parseDescription;
            movie.DescriptionDidLoad();
        }