目标网页数据展示使用的是GridView,也是使用它自带的分页,怎么获取之后的数据?

解决方案 »

  1.   

    难道GridView也承认URL参数吗?
      

  2.   

    Regex regContent = new Regex("<div id=\"artibody\">(?<content>.*?)([\\s\\S]*)?</div>", RegexOptions.IgnoreCase | RegexOptions.Multiline);
         string contents = regContent.Match(html).Value;//得到文章内容
       string finalContent = "";
         ArrayList urlList = new ArrayList(); if (content.IndexOf("下一页") != -1)
    {//如果存在下一页,说明有多页
        Regex regUrl = new Regex("<a\\s+href='(?<url>.*?)'>", RegexOptions.Multiline | RegexOptions.IgnoreCase);//获取下一页里面的链接
       MatchCollection matches = regUrl.Matches(content);     foreach (Match match in matches)
        {
            string childurl = match.Groups["url"].Value;//得到多页网页的网址列表
            if (urlList.Contains(childurl))
            {
                urlList.Add(childurl);
           }
        }
        finalContent += content.Substring(0, content.IndexOf("<div style=\"text-align:center;\">")) + "</div>";
    }
    else {
        //没有下一页截取成功
        finalContent = content;
    }