当前位置:编程学习 > C#/ASP.NET >>

求大神给一段采集URL的代码吧

 求大神给一段采集URL的代码吧
我只需要采集各种URL就可以了
希望大神能给出代码并说一下怎么使用呢 --------------------编程问答-------------------- http://www.2cto.com/kf/201106/93983.html --------------------编程问答-------------------- //第三个:截取网址
    public static ArrayList GetUrl(string code, string wordsBegin, string wordsEnd)
    {
        ArrayList urlList = new ArrayList();
        //string NewsTitle = "";
        Regex regex1 = new Regex("" + wordsBegin + @"(?<title>[\s\S]+?)" + wordsEnd + "", RegexOptions.Compiled | RegexOptions.IgnoreCase);
        for (Match match1 = regex1.Match(code); match1.Success; match1 = match1.NextMatch())
        {
            urlList.Add(match1.Groups["title"].ToString());
        }
        return urlList;
    }




其实简单的可以用jquery直接采集~~~

 function caiji(p) {
            $.get("http://www.sz800.com/bus/stationlist/" + p + ".htm", function (data) {
                var len = $(data).find(".ulist li a").length;
                $(data).find(".ulist li a").each(function (i) {

                    var url = "http://www.sz800.com" + $(this).attr("href");
                    $.get(url, function (ret) {
                        var name = $(ret).find("#plStation span.f60").html();
                        if (name != "" && name != null) {
                            var bus = "";
                            $(ret).find("#lb_NoRecord a").each(function () {
                                bus += $.trim($(this).html()) + " ";
                            })
                            $.post("SQL.ASPX",
                                                { "name": name, "bus": bus }
                                                , function (ret) {
                                                    if (ret == 1) {
                                                        success += 1;
                                                        $("#cg").html("成功" + success + "条.");
                                                    }
                                                })
                            $("#div_jindu").html("正在采集<font color='red'>" + i + "/" + len + "</a>条.");
                        }
                    });
                })
            })
        }  

http://buslover.net/site/index
我这里就是用jquery采集的··· --------------------编程问答-------------------- 这种没有万能的吧 --------------------编程问答-------------------- 真还没有 --------------------编程问答-------------------- 前段时间无聊写了个,不过是CS的
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,