コード例 #1
0
        public override void Question()
        {
            DownloadHTML downloadHTML = new DownloadHTML();

            try
            {
                HtmlDocument htmlDoc   = downloadHTML.DownloadHTMLDoc(Url);
                WebClient    webClient = new WebClient();
                var          nodes     = htmlDoc.DocumentNode.Descendants("img");

                foreach (HtmlNode node in nodes)
                {
                    foreach (HtmlAttribute htmlAttribute in node.Attributes)
                    {
                        if (htmlAttribute.Value.ToLower().Contains(SearchText.ToLower()))
                        {
                            imageExt  = node.GetAttributeValue("src");
                            imageData = webClient.DownloadData(imageExt);
                            stream    = new MemoryStream(imageData);
                        }
                    }
                }
            }
            catch (Exception x)
            {
            }
        }