如何获取期间索引状态google api?

时间:2018-01-04 14:41:38

标签: google-webmaster-tools google-api-webmasters

  

调试($ sitemaps-> listSitemaps(" http://example.com&#34 ;,   ['内容' = GT; '索引']));

返回

object(Google_Service_Webmasters_SitemapsListResponse) {
    [protected] collection_key => 'sitemap'
    [protected] internal_gapi_mappings => array()
    [protected] sitemapType => 'Google_Service_Webmasters_WmxSitemap'
    [protected] sitemapDataType => 'array'
    [protected] modelData => array(
        'sitemap' => array(
            (int) 0 => array(
                'path' => 'http://example.com/sitemap.xml',
                'lastSubmitted' => '2017-12-31T17:06:56.592Z',
                'isPending' => false,
                'isSitemapsIndex' => false,
                'type' => 'sitemap',
                'lastDownloaded' => '2018-01-03T11:42:39.262Z',
                'warnings' => '0',
                'errors' => '0',
                'contents' => array(
                    (int) 0 => array(
                        'type' => 'web',
                        'submitted' => '4',
                        'indexed' => '0'
                    )
                )
            )
        )
    )
    [protected] processed => array()
}

modeldata应该返回一个包含日期和索引值的数据数组

1 个答案:

答案 0 :(得分:0)

我担心它目前还不是Search Console API的一部分。 Google产品论坛上也有此帖子:https://productforums.google.com/forum/?hl=en#!topic/webmasters/KIUsaXpquKY;context-place=topicsearchin/webmasters/category $ 3Awebmaster-tools%7Csort:relevance%7Cspell:false

从那以后我再也没有看到任何变化,所以如果我是你,我就不会屏住呼吸。

从API获得的最接近数字,表明Google索引的页面数量是对您提交的所有站点地图和/或站点地图索引的所有content []。indexed求和。可能您只提交了一个引用所有站点地图的站点地图索引,因此,如果您使用Sitemaps:get(https://developers.google.com/webmaster-tools/search-console-api-original/v3/sitemaps/get)请求一个站点地图索引,则会获得索引的页面总数。

但是该数字与实际索引状态的关联性很差,您无法以我不正确理解的方式在Search Console用户界面中找到该数字。

我认为,如果您的sitemap.xml包含网站的每个页面,则contents []。indexed的总和将与被索引的页面总数密切相关。似乎并非如此。