【问题标题】:Programmatically get the number of indexed pages in Google?以编程方式获取 Google 中的索引页数?
【发布时间】:2009-12-02 16:08:50
【问题描述】:

作为 SEO 指标,我想以编程方式获取 Google 索引页面的数量。

(如果我搜索“site:mydomain.com”,我想获取找到的页面数)。

是否有任何 lib 或者我需要解析 google 请求?

【问题讨论】:

    标签: c# asp.net seo google-chrome


    【解决方案1】:

    您应该使用 Google Webmaster Tool API。 首先使用 gmail 帐户登录谷歌网站管理员并熟悉功能,然后查看以下开发指南:
    http://code.google.com/apis/webmastertools/docs/2.0/developers_guide.html

    【讨论】:

      【解决方案2】:

      以下是我整理的一些内容,适用于每小时每个 IP 地址的几个查询:

          public static Int32 GooglePages(string sourceDomain)
          {
              String googleSource
                  = (new WebClient()).DownloadString(
                      @"http://www.google.com/search?q=site%3A" + sourceDomain);
      
              return Convert.ToInt32(
                  Regex.Match(googleSource, 
                      @"about \<b\>([0-9,]*)\<\/b\> from ")
                      .Groups[1].Value.Replace(",", ""));
      
          }
      

      如果您要经常使用它,或者定期进行大量查询,我建议您使用官方认可的 API。

      【讨论】:

        【解决方案3】:

        您的网站是否已在 Google Analytics(分析)中设置?如果是这样,您可以使用Google Analytics API 获取此类信息。

        如果您对如何在 asp.net refer to this question 中实现此功能感兴趣。

        【讨论】:

          【解决方案4】:

          您可能可以使用Google API,而不是解析搜索结果。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2010-11-26
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-06-16
            • 2013-02-23
            相关资源
            最近更新 更多