Пример #1
0
        /// <summary>
        ///  反向链接信息
        /// </summary>
        public static string GetBackLinkInfo(EnumSearchEngine _engine, string Url)
        {
            CutRegexInfo model  = SeoHelper.GetCutRegexInfo(_engine, Url, false);
            string       Html   = HtmlCatch.GetHtml(model.siteUrl, model.encoding);
            string       Result = SeoHelper.GetMetaString(Html, model.regStart, model.regEnd, true);

            return(HtmlCatch.NoHTML(Result));
        }
Пример #2
0
        /// <summary>
        ///  正则表达式信息设置
        /// </summary>
        /// <param name="_engine"></param>
        /// <param name="Url"></param>
        /// <returns></returns>
        public static CutRegexInfo GetCutRegexInfo(EnumSearchEngine _engine, string Url, bool isRecord)
        {
            CutRegexInfo Model = new CutRegexInfo();

            switch (_engine)
            {
            case EnumSearchEngine.Google:
                Model.regStart = "找到";
                Model.regEnd   = "条结果";
                Model.encoding = "gb2312";
                if (isRecord)
                {
                    Model.siteUrl = "http://www.google.com.hk/search?hl=zh-CN&source=hp&q=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://www.google.com.hk/search?hl=zh-CN&source=hp&q=link:" + Url;
                }
                break;

            case EnumSearchEngine.Baidu:
                Model.regStart = "找到相关结果";
                Model.regEnd   = "个";
                Model.encoding = "gb2312";
                if (isRecord)
                {
                    Model.siteUrl = "http://www.baidu.com/s?wd=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://www.baidu.com/s?cl=3&wd=domain:" + Url;
                }
                break;

            case EnumSearchEngine.Yahoo:
                Model.regStart = "找到相关网页";
                Model.regEnd   = "条";
                Model.encoding = "utf-8";
                if (isRecord)
                {
                    Model.siteUrl = "http://one.cn.yahoo.com/s?p=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://sitemap.cn.yahoo.com/search?p=" + Url + "&bwm=i";
                }
                break;

            case EnumSearchEngine.Sogou:
                Model.regStart = "找到";
                Model.regEnd   = "个网页";
                Model.encoding = "gb2312";
                if (isRecord)
                {
                    Model.siteUrl = "http://www.sogou.com/web?query=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://www.sogou.com/web?query=link:" + Url;
                }
                break;

            case EnumSearchEngine.Soso:
                Model.regStart = "搜索到";
                Model.regEnd   = "项结果";
                Model.encoding = "gb2312";
                if (isRecord)
                {
                    Model.siteUrl = "http://www.soso.com/q?pid=s.idx&w=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://www.soso.com/q?pid=s.idx&w=link:" + Url;
                }
                break;

            case EnumSearchEngine.Bing:
                Model.regStart = "共";
                Model.regEnd   = "条";
                Model.encoding = "utf-8";
                if (isRecord)
                {
                    Model.siteUrl = "http://cn.bing.com/search?form=QBLH&filt=all&q=site%3A" + Url;
                }
                else
                {
                    Model.siteUrl = "http://cn.bing.com/search?form=QBLH&filt=all&q=link:" + Url;
                }
                break;

            case EnumSearchEngine.Youdao:
                Model.regStart = "共";
                Model.regEnd   = "条结果";
                Model.encoding = "utf-8";
                if (isRecord)
                {
                    Model.siteUrl = "http://www.youdao.com/search?ue=utf8&keyfrom=web.index&q=site:" + Url;
                }
                else
                {
                    Model.siteUrl = "http://www.youdao.com/search?ue=utf8&keyfrom=web.index&q=link:" + Url;
                }
                break;
            }
            return(Model);
        }