在谷歌自定义搜索API的结果提供的json中显示日期

时间:2014-11-26 11:52:28

标签: php json google-app-engine

我正在通过php使用谷歌自定义搜索API,它为我提供了在json中搜索的结果。

如何在json中获取每个结果的发布日期?我看到有"publisheddate":"......"但我无法在此参数中输入我的代码:

<?php
            foreach ($result['items'] as $item) {
                $link = rawurldecode($item['link']);
?>
            <li>
            <p class="result-object">
            <a href="<?php echo $link; ?>"><img alt="<?php echo htmlentities($item['title']); ?>"
            src="<?php $thumbnail = isset($item['pagemap']['metatags'][0]['thumbnailurl']) ? $item['pagemap']['metatags'][0]['thumbnailurl'] : (isset($item['pagemap']['cse_thumbnail'][0]['src']) ? $item['pagemap']['cse_thumbnail'][0]['src'] : (isset($item['pagemap']['cse_image'][0]['src']) ? $item['pagemap']['cse_image'][0]['src'] : './meta/img/thumbnail-default.png'));
            echo rawurldecode($thumbnail);?>" /></a>
            </p>
            <p class="result-description">
            <a href="<?php echo $link; ?>"><?php echo $item['htmlTitle']; ?></a>
            <br />
            <?php echo $item['htmlFormattedUrl']; ?>
            <br />
            <?php echo $item['htmlSnippet']; ?>
            <br />
            <?php 

                echo $item['pagemap']['metatags'][0]['thumbnailurl']; //didn't work


             ?>
            <br />
            <?php //echo 'id: '.$sr['cacheId']; ?>
            <a class="expand" href="<?php echo $link; ?>">more</a>
            <br />
            <br />
            </p>
            </li>
<?php
            }
?>
        </ul>
<?php

这是json结果的一个例子:

{
 "kind": "customsearch#search",
 "url": {
  "type": "application/json",
  "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
 },
 "queries": {
  "nextPage": [
   {
    "title": "Google Custom Search - tramway",
    "totalResults": "656000",
    "searchTerms": "tramway",
    "count": 10,
    "startIndex": 11,
    "inputEncoding": "utf8",
    "outputEncoding": "utf8",
    "safe": "off",95794
    "cx": "rf:mfcvcqr1viw"
   }
  ],
  "request": [
   {
    "title": "Google Custom Search - tramway",
    "totalResults": "656000",
    "searchTerms": "tramway",
    "count": 10,
    "startIndex": 1,
    "inputEncoding": "utf8",
    "outputEncoding": "utf8",
    "safe": "off",
    "cx": "...."
   }
  ]
 },
 "context": {
  "title": "api"
 },
 "searchInformation": {
  "searchTime": 0.299961,
  "formattedSearchTime": "0.30",
  "totalResults": "656000",
  "formattedTotalResults": "656,000"
 },
 "items": [
  {
   "kind": "customsearch#result",
   "title": "Cheap hotels near Palm Springs Aerial Tramway - Hotels.com",
   "htmlTitle": "Cheap hotels near Palm Springs Aerial \u003cb\u003eTramway\u003c/b\u003e - Hotels.com",
   "link": "http://www.hotels.com/de1710382/hotels-near-palm-springs-aerial-tramway-palm-springs-united-states-of-america/",
   "displayLink": "www.hotels.com",
   "snippet": "Compare all hotels based up on average nightly rate and book the cheapest \nhotels near Palm Springs Aerial Tramway, Palm Springs. Book and save on hotel\n ...",
   "htmlSnippet": "Compare all hotels based up on average nightly rate and book the cheapest \u003cbr\u003e\nhotels near Palm Springs Aerial \u003cb\u003eTramway\u003c/b\u003e, Palm Springs. Book and save on hotel\u003cbr\u003e\n&nbsp;...",
   "cacheId": "DAhkC4jjOLUJ",
   "formattedUrl": "www.hotels.com/.../hotels-near-palm-springs-aerial-tramway-palm-springs- united-states-of-america/",
   "htmlFormattedUrl": "www.hotels.com/.../hotels-near-palm-springs-aerial-\u003cb\u003etramway\u003c/b\u003e-palm-springs- united-states-of-america/",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://exp.cdn-hotels.com/hotels/8000000/7810000/7808200/7808113/7808113_1_e.jpg"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "128",
      "height": "72",
      "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSfzrwon7PFVDPKZ4zHkwCig3q2psBZyWI3fcx8mK27AQF1myh9qknoJQc"
     }
    ],
    "article": [
     {
      "name": "Palm Springs Aerial Tramway hotels, Palm Springs",
      "articlebody": "Palm Springs Aerial Tramway in the Palm Springs area, California Are you looking for a cheap Palm Springs Aerial Tramway hotel, a 5 star Palm Springs Aerial Tramway hotel or a family friendly..."
     }
    ],
    "webpage": [
     {
      "breadcrumb": "HotelsUnited States of America HotelsCalifornia hotelsHotels in Palm SpringsHotels near Palm Springs Aerial Tramway",
      "name": "Hotels",
      "url": "Hotels"
     }
    ],
    "Breadcrumb": [
     {
      "title": "Hotels",
      "url": "Hotels"
     },
     {
      "title": "United States of America Hotels",
      "url": "United States of America Hotels"
     },
     {
      "title": "California hotels",
      "url": "California hotels"
     },
     {
      "title": "Hotels in Palm Springs",
      "url": "Hotels in Palm Springs"
     }
    ],
    "hotel": [
     {
      "url": "The New Palm Springs Inn",
      "name": "The New Palm Springs Inn"
     },
     {
      "url": "Days Inn Palm Springs",
      "name": "Days Inn Palm Springs"
     },
     {
      "url": "The Monroe Palm Springs",
      "name": "The Monroe Palm Springs"
     },
     {
      "url": "Ivy Palm Resort & Spa",
      "name": "Ivy Palm Resort & Spa"
     },
     {
      "url": "The Mediterraneo Resort",
      "name": "The Mediterraneo Resort"
     },
     {
      "url": "The Palm Springs Hotel",
      "name": "The Palm Springs Hotel"
     },
     {
      "url": "The D Resort",
      "name": "The D Resort"
     },
     {
      "url": "Tuscany Manor Resort",
      "name": "Tuscany Manor Resort"
     },
     {
      "url": "Garden Vista Hotel",
      "name": "Garden Vista Hotel"
     },
     {
      "url": "Desert Vacation Villas",
      "name": "Desert Vacation Villas"
     }
    ],
    "metatags": [
     {
      "title": "Cheap hotels near Palm Springs Aerial Tramway - Hotels.com",
      "fb:app_id": "105208249622845",
      "og:type": "website",
      "og:title": "Cheap hotels near Palm Springs Aerial Tramway - Hotels.com",
      "og:description": "Compare all hotels based up on average nightly rate and book the cheapest hotels near Palm Springs Aerial Tramway, Palm Springs. Book and save on hotel rooms near to Palm Springs Aerial Tramway in California with our last minute Palm Springs Aerial Tramway deals & offers.",
      "og:image": "http://a1.cdn-hotels.com/static/common/64.0/images/common/logos/h_onebrand_119x100.png",
      "og:url": "http://www.hotels.com/de1710382/hotels-near-palm-springs-aerial-tramway-palm-springs-united-states-of-america/",
      "skype_toolbar": "SKYPE_TOOLBAR_PARSER_COMPATIBLE"
     }
    ],
    "place": [
     {
      "name": "Popular with travelers from US"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Tramway V -- Encyclopedia Britannica",
   "htmlTitle": "\u003cb\u003eTramway\u003c/b\u003e V -- Encyclopedia Britannica",
   "link": "http://www.britannica.com/EBchecked/topic/1782196/Tramway-V",
   "displayLink": "www.britannica.com",
   "snippet": "Tramway V. ... are finished and click submit, your modifications will be sent to our \neditors for review. The topic Tramway V is discussed in the following articles: ...",
   "htmlSnippet": "\u003cb\u003eTramway\u003c/b\u003e V. ... are finished and click submit, your modifications will be sent to our \u003cbr\u003e\neditors for review. The topic \u003cb\u003eTramway\u003c/b\u003e V is discussed in the following articles:&nbsp;...",
   "cacheId": "5iMaVHaHoxoJ",
   "formattedUrl": "www.britannica.com/EBchecked/topic/1782196/Tramway-V",
   "htmlFormattedUrl": "www.britannica.com/EBchecked/topic/1782196/\u003cb\u003eTramway\u003c/b\u003e-V",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://www.britannica.com/resources/images/shared/facebook-logo.png"
     }
    ],
    "metatags": [
     {
      "viewport": "width=device-width, initial-scale=1.0",
      "recommendable": "no",
      "canonical": "http://www.britannica.com/EBchecked/topic/1782196/Tramway-V",
      "og:type": "article",
      "og:title": "Tramway V",
      "og:description": "Tramway V",
      "og:site_name": "Encyclopedia Britannica",
      "og:url": "http://www.britannica.com/EBchecked/topic/1782196/Tramway-V",
      "og:image": "http://www.britannica.com/resources/images/shared/facebook-logo.png",
      "og:image:type": "image/png",
      "og:image:width": "90",
      "og:image:height": "90",
      "name": "Tramway V"
     }
    ],
    "Article": [
     {
      "url": "http://www.britannica.com/EBchecked/topic/1782196/Tramway-V",
      "name": "Tramway V",
      "about": "Ivan Albertovich Puni"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Palm Springs Aerial Tramway",
   "htmlTitle": "Palm Springs Aerial \u003cb\u003eTramway\u003c/b\u003e",
   "link": "http://www.desertsun.com/story/travel/2014/10/07/palm-springs-aerial-tramway/16884547/",
   "displayLink": "www.desertsun.com",
   "snippet": "Oct 7, 2014 ... Constructed in rugged Chino Canyon on the north edge of Palm Springs, more \nthan 12 million people have been safely transported by the ...",
   "htmlSnippet": "Oct 7, 2014 \u003cb\u003e...\u003c/b\u003e Constructed in rugged Chino Canyon on the north edge of Palm Springs, more \u003cbr\u003e\nthan 12 million people have been safely transported by the&nbsp;...",
   "cacheId": "S08qTKoJMmAJ",
   "formattedUrl": "www.desertsun.com/story/travel/2014/10/...tramway/16884547/",
   "htmlFormattedUrl": "www.desertsun.com/story/travel/2014/10/...\u003cb\u003etramway\u003c/b\u003e/16884547/",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://www.gannett-cdn.com/-mm-/a4dce30acf87ac96b14fd6ca7a421a6c238b9c3c/c=0-111-2400-1461&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/10/07/-tram7.jpg20120430.jpg"
     }
    ],
    "person": [
     {
      "name": "The Desert Sun"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "300",
      "height": "168",
      "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSoMsE-7tUCC8xY1uXbcvKLQLScIMQTsLsU37fHKjs9FYG0JRk7Uo0arCo"
     }
    ],
    "newsarticle": [
     {
      "description": "Constructed in rugged Chino Canyon on the north edge of Palm Springs, more than 12 million people have been safely transported by the Palm Springs Aerial Tramway into the majestic mountains...",
      "datemodified": "2014-10-07T20:17:10.0000000",
      "datepublished": "2014-10-07T20:17:10.0000000",
      "articlesection": "travel",
      "thumbnailurl": "http://www.gannett-cdn.com/-mm-/ee89874796d11f1f9940b0241be161fac78ed07f/c=414-0-1986-1572&r=x153&c=150x150/local/-/media/PalmSprings/2014/10/07/-tram7.jpg20120430.jpg",
      "image": "http://www.gannett-cdn.com/-mm-/2da5443efffb43906f4d833db9118ef8e0ff68b1/c=414-0-1986-1572&r=x203&c=200x200/local/-/media/PalmSprings/2014/10/07/-tram7.jpg20120430.jpg",
      "headline": "Palm Springs Aerial Tramway",
      "articlebody": "Visitors to the Palm Springs Aerial Tramway look over the Coachella Valley on an observation deck. (Photo: Jay Calderon/The Desert Sun )CONNECTTWEETLINKEDINCOMMENTEMAILMOREConstructed in rugged..."
     }
    ],
    "metatags": [
     {
      "google": "notranslate",
      "apple-itunes-app": "app-id=600074187",
      "fb:app_id": "116853348383382",
      "og:image": "http://www.gannett-cdn.com/-mm-/a4dce30acf87ac96b14fd6ca7a421a6c238b9c3c/c=0-111-2400-1461&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/10/07/-tram7.jpg20120430.jpg",
      "og:image:width": "3200",
      "og:image:height": "1600",
      "og:title": "Palm Springs Aerial Tramway",
      "og:description": "Constructed in rugged Chino Canyon on the north edge of Palm Springs, more than 12 million people have been safely transported by the Palm Springs Aerial Tramway into the majestic mountains overlooking the Coachella Valley since the attraction opened in September 1963.",
      "og:url": "http://www.desertsun.com/story/travel/2014/10/07/palm-springs-aerial-tramway/16884547/",
      "og:type": "article",
      "viewport": "width=1070"
     }
    ],
    "imageobject": [
     {
      "url": "http://www.gannett-cdn.com/-mm-/5a52903c827495399443de39835e6b20fbe786ed/c=152-0-2248-1572&r=x404&c=534x401/local/-/media/PalmSprings/2014/10/07/-tram7.jpg20120430.jpg",
      "name": "-tram7.jpg_20120430.jpg"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Imagine a Central Park to Queens tramway - NY Daily News",
   "htmlTitle": "Imagine a Central Park to Queens \u003cb\u003etramway\u003c/b\u003e - NY Daily News",
   "link": "http://www.nydailynews.com/new-york/queens/imagine-central-park-queens-tramway-article-1.1482275",
   "displayLink": "www.nydailynews.com",
   "snippet": "Oct 10, 2013 ... The best of the bunch is the ultimate pie-in-the-sky: an ambitious two-sided \nextension of the Roosevelt Island Tramway west to Central Park ...",
   "htmlSnippet": "Oct 10, 2013 \u003cb\u003e...\u003c/b\u003e The best of the bunch is the ultimate pie-in-the-sky: an ambitious two-sided \u003cbr\u003e\nextension of the Roosevelt Island \u003cb\u003eTramway\u003c/b\u003e west to Central Park&nbsp;...",
   "formattedUrl": "www.nydailynews.com/.../imagine-central-park-queens-tramway-article-1. 1482275",
   "htmlFormattedUrl": "www.nydailynews.com/.../imagine-central-park-queens-\u003cb\u003etramway\u003c/b\u003e-article-1. 1482275",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://assets.nydailynews.com/polopoly_fs/1.1482274!/img/httpImage/image.jpg_gen/derivatives/landscape_1200/tram11q-1-web.jpg"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "310",
      "height": "163",
      "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcT26JqDaLCgzbq8KjhKfK1Uj1HSrOgxir5t6q6lYdhb1cGoSZnPnzADNp0"
     }
    ],
    "newsarticle": [
     {
      "thumbnailurl": "http://assets.nydailynews.com/polopoly_fs/1.1482274!/img/httpImage/image.jpg_gen/derivatives/landscape_1200/tram11q-1-web.jpg",
      "description": "Imagine going from Central Park to Queens Plaza without ever touching the ground.",
      "headline": "A commute with a view! Visionaries plan a Queens-to-Central Park tramway",
      "alternativeheadline": "Roosevelt Island route would be expanded in both directions. Commuters aren't too impressed.",
      "articlebody": "The latest visionary idea for Queens includes a two-stop extension of the Roosevelt Island tram to Queens Plaza. Imagine going from Central Park to Queens Plaza without ever touching the ground...."
     }
    ],
    "metatags": [
     {
      "nydn_section": "Queens",
      "viewport": "width=1070, maximum-scale=1.0",
      "fb:app_id": "107464888913",
      "fb:admins": "1594068001",
      "og:site_name": "NY Daily News",
      "article:publisher": "https://www.facebook.com/thenewyorkdailynews",
      "msvalidate.01": "02916AAC0DA8B068EFE01D721E03ED7E",
      "twitter:card": "summary",
      "twitter:site": "@nydailynews",
      "og:title": "Imagine a Central Park to Queens tramway",
      "og:type": "article",
      "og:url": "http://www.nydailynews.com/new-york/queens/imagine-central-park-queens-tramway-article-1.1482275",
      "news_keywords": "Katie Riegel, Queens Plaza, Central Park (New York), Daniel McPhee",
      "og:image": "http://assets.nydailynews.com/polopoly_fs/1.1482274!/img/httpImage/image.jpg_gen/derivatives/landscape_1200/tram11q-1-web.jpg",
      "og:description": "Imagine going from Central Park to Queens Plaza without ever touching the ground.",
      "nydn_byline": "JOEY SCARBOROUGH, LISA L. COLANGELO"
     }
    ],
    "imageobject": [
     {
      "description": "The latest visionary idea for Queens includes a two-stop extension of the Roosevelt Island tram to Queens Plaza."
     },
     {
      "description": "The Queensboro Plaza subway station allows already allows riders direct access to Central Park South via the N and Q trains, with only one stop in between. The proposed tram would separate..."
     },
     {
      "description": "Patrons of the tram, seen here at 60th St. and Second Ave., say the cars are crowded already, and more stops could exacerbate the issue."
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Muralist transforms 'drab' Palm Springs tramway station",
   "htmlTitle": "Muralist transforms &#39;drab&#39; Palm Springs \u003cb\u003etramway\u003c/b\u003e station",
   "link": "http://www.desertsun.com/story/money/business/tourism/2014/08/08/palm-springs-tramway-muralist-transforms/13762635/",
   "displayLink": "www.desertsun.com",
   "snippet": "Aug 9, 2014 ... Artist Keith Blum on his trompe l'oeil mural for the Palm Springs Tramway and his \nreality TV show \"The Artist\". Richard Lui/The Desert Sun.",
   "htmlSnippet": "Aug 9, 2014 \u003cb\u003e...\u003c/b\u003e Artist Keith Blum on his trompe l&#39;oeil mural for the Palm Springs \u003cb\u003eTramway\u003c/b\u003e and his \u003cbr\u003e\nreality TV show &quot;The Artist&quot;. Richard Lui/The Desert Sun.",
   "cacheId": "y8C3NDxa6xcJ",
   "formattedUrl": "www.desertsun.com/story/money/.../08/...tramway.../13762635/",
   "htmlFormattedUrl": "www.desertsun.com/story/money/.../08/...\u003cb\u003etramway\u003c/b\u003e.../13762635/",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://www.gannett-cdn.com/-mm-/193234bfe0348ac2f7b21296ccb80545630a1757/c=0-196-5322-3190&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/08/08/tdstrammural01.jpg"
     }
    ],
    "videoobject": [
     {
      "width": "880",
      "height": "495",
      "thumbnailurl": "http://bcdownload.gannett.edgesuite.net/palmsprings/41188256001/201408/1807/41188256001_3720264738001_thumbnail-for-video-3720255418001.jpg?pubId=41188256001",
      "contenturl": "http://www.desertsun.com/videos/life/entertainment/arts/2014/08/10/13856689/",
      "uploaddate": "8/10/2014 2:45:01 AM",
      "description": "Artist Keith Blum on his trompe l'oeil mural for the Palm Springs Tramway and his reality TV show \"The Artist\". Richard Lui/The Desert Sun"
     }
    ],
    "person": [
     {
      "name": "Skip Descant, The Desert Sun"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "300",
      "height": "168",
      "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSErpWIQ4akWRMeeCx4oT7_HTed5wOKbtAwlcTkLHGU3ZIEhNlPWJGmJS0"
     }
    ],
    "newsarticle": [
     {
      "description": "While waiting for the next tram car heading down to the valley floor, settle up next to a fire, take a view of the morning sun rising over the Little San Bernardino Mountains.",
      "datemodified": "2014-08-10T02:47:34.4370000",
      "datepublished": "2014-08-08T01:27:55.0000000",
      "articlesection": "money,business,tourism",
      "thumbnailurl": "http://www.gannett-cdn.com/-mm-/f0ef029995087e711ec1f582b9d5574113d8aec2/c=968-0-4353-3385&r=x153&c=150x150/local/-/media/PalmSprings/2014/08/08/tdstrammural01.jpg",
      "image": "http://www.gannett-cdn.com/-mm-/bc3973de83bffe27d9c959ce5097244ecb63433e/c=968-0-4353-3385&r=x203&c=200x200/local/-/media/PalmSprings/2014/08/08/tdstrammural01.jpg",
      "headline": "Muralist transforms 'drab' Palm Springs tramway station",
      "articlebody": "Artist Keith Blum speaks as a reality television film crew shoots the unveiling his work at the Palm Springs Ariel Tramway on Thursday. (Photo: Richard Lui/The Desert Sun ) 137 CONNECTTWEETLINKEDIN..."
     }
    ],
    "metatags": [
     {
      "google": "notranslate",
      "apple-itunes-app": "app-id=600074187",
      "fb:app_id": "116853348383382",
      "og:image": "http://www.gannett-cdn.com/-mm-/193234bfe0348ac2f7b21296ccb80545630a1757/c=0-196-5322-3190&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/08/08/tdstrammural01.jpg",
      "og:image:width": "3200",
      "og:image:height": "1600",
      "og:title": "Muralist transforms 'drab' Palm Springs tramway station",
      "og:description": "While waiting for the next tram car heading down to the valley floor, settle up next to a fire, take a view of the morning sun rising over the Little San Bernardino Mountains.",
      "og:url": "http://www.desertsun.com/story/money/business/tourism/2014/08/08/palm-springs-tramway-muralist-transforms/13762635/",
      "og:type": "article",
      "viewport": "width=1070"
     }
    ],
    "imageobject": [
     {
      "url": "http://www.gannett-cdn.com/-mm-/4f43135baddae5b837d849d1295d59748e032400/c=404-0-4917-3385&r=x404&c=534x401/local/-/media/PalmSprings/2014/08/08/tdstrammural01.jpg",
      "name": "TDS Tram Mural01.JPG"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Paris Tramway Web Links - Paris for Visitors",
   "htmlTitle": "Paris \u003cb\u003eTramway\u003c/b\u003e Web Links - Paris for Visitors",
   "link": "http://europeforvisitors.com/paris/articles/paris-trams-web-links.htm",
   "displayLink": "europeforvisitors.com",
   "snippet": "Paris Trams. Page 2. Continued from page 1. Paris Tramways Ligne 3. ABOVE: A \nplatform on Ligne 3, which runs mostly along the southern edge of the city ...",
   "htmlSnippet": "Paris Trams. Page 2. Continued from page 1. Paris \u003cb\u003eTramways\u003c/b\u003e Ligne 3. ABOVE: A \u003cbr\u003e\nplatform on Ligne 3, which runs mostly along the southern edge of the city&nbsp;...",
   "cacheId": "0eItXzuqiwMJ",
   "formattedUrl": "europeforvisitors.com/paris/articles/paris-trams-web-links.htm",
   "htmlFormattedUrl": "europeforvisitors.com/paris/articles/paris-trams-web-links.htm",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://europeforvisitors.com/paris/images/tram_3_stop_pto_marc_bertrand_164-30.jpg"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "220",
      "height": "145",
      "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSizj3BDTfdJxXomKbV64-Sc25b6_mSgjSWtwzIU4OCko0ukm8mIMtGQ3o"
     }
    ],
    "article": [
     {
      "articlebody": "ABOVE: A platform on Ligne 3, which runs mostly along the southern edge of the city between Ponte de Boulevard Victor RER station in the 15th arrondissement and the Porte d'Ivry Métro station...",
      "name": "Paris Tramway Web links"
     }
    ],
    "metatags": [
     {
      "microsoft border": "trb",
      "viewport": "width=device-width"
     }
    ]
   }
  },
  {
   "kind": "customsearch#result",
   "title": "Palm Springs Aerial Tramway delays parking plan",
   "htmlTitle": "Palm Springs Aerial \u003cb\u003eTramway\u003c/b\u003e delays parking plan",
   "link": "http://www.desertsun.com/story/money/business/tourism/2014/07/17/palm-springs-tramway-parking/12770229/",
   "displayLink": "www.desertsun.com",
   "snippet": "Jul 16, 2014 ... Don't let that parking attendant booth at the Palm Springs Aerial Tramway fool \nyou.",
   "htmlSnippet": "Jul 16, 2014 \u003cb\u003e...\u003c/b\u003e Don&#39;t let that parking attendant booth at the Palm Springs Aerial \u003cb\u003eTramway\u003c/b\u003e fool \u003cbr\u003e\nyou.",
   "cacheId": "KvHAtYcbgDoJ",
   "formattedUrl": "www.desertsun.com/story/money/business/...tramway.../12770229/",
   "htmlFormattedUrl": "www.desertsun.com/story/money/business/...\u003cb\u003etramway\u003c/b\u003e.../12770229/",
   "pagemap": {
    "cse_image": [
     {
      "src": "http://www.gannett-cdn.com/-mm-/0b09646e5d2dcef04f2f3a1452a664722247a07a/c=0-100-1920-1180&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/07/17/tdsdc5-6doocek8p8612pduwdhyoriginal.jpg"
     }
    ],
    "person": [
     {
      "name": "Skip Descant, The Desert Sun"
     }
    ],
    "cse_thumbnail": [
     {
      "width": "300",
      "height": "168",
      "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTbCdR1jrWuUx9fRXg8P_NcXJ9c8ZLcc1m7DyUlsqiN9Dep4h2qZZIr2OtN"
     }
    ],
    "newsarticle": [
     {
      "description": "Don’t let that parking attendant booth at the Palm Springs Aerial Tramway fool you.",
      "datemodified": "2014-07-17T01:32:45.0000000",
      "datepublished": "2014-07-17T01:32:45.0000000",
      "articlesection": "money,business,tourism",
      "thumbnailurl": "http://www.gannett-cdn.com/-mm-/fded82662fa62f1ef27fc0660575089a74a7ab99/c=320-0-1600-1280&r=x153&c=150x150/local/-/media/PalmSprings/2014/07/17/tdsdc5-6doocek8p8612pduwdhyoriginal.jpg",
      "image": "http://www.gannett-cdn.com/-mm-/f49ebc2a0e88a969fcbb0727e244782cdbd3320d/c=320-0-1600-1280&r=x203&c=200x200/local/-/media/PalmSprings/2014/07/17/tdsdc5-6doocek8p8612pduwdhyoriginal.jpg",
      "headline": "Palm Springs Aerial Tramway delays parking plan",
      "articlebody": "The new tram kiosk located at the entrance of the Valley Station of the Palm Springs Aerial Tramway. (Photo: Michael Snyder/The Desert Sun ) 91 CONNECTTWEET 1 LINKEDINCOMMENTEMAILMOREDon’t..."
     }
    ],
    "metatags": [
     {
      "google": "notranslate",
      "apple-itunes-app": "app-id=600074187",
      "fb:app_id": "116853348383382",
      "og:image": "http://www.gannett-cdn.com/-mm-/0b09646e5d2dcef04f2f3a1452a664722247a07a/c=0-100-1920-1180&r=x1803&c=3200x1800/local/-/media/PalmSprings/2014/07/17/tdsdc5-6doocek8p8612pduwdhyoriginal.jpg",
      "og:image:width": "3200",
      "og:image:height": "1600",
      "og:title": "Palm Springs Aerial Tramway delays parking plan",
      "og:description": "Don’t let that parking attendant booth at the Palm Springs Aerial Tramway fool you.",
      "og:url": "http://www.desertsun.com/story/money/business/tourism/2014/07/17/palm-springs-tramway-parking/12770229/",
      "og:type": "article",
      "viewport": "width=1070"
     }
    ],
    "imageobject": [
     {
      "url": "http://www.gannett-cdn.com/-mm-/f8ca59d116a16f29aff3515c384b05f3b050ce56/c=106-0-1813-1280&r=x404&c=534x401/local/-/media/PalmSprings/2014/07/17/tdsdc5-6doocek8p8612pduwdhyoriginal.jpg",
      "name": "tdsdc5-6doocek8p8612pduwdhy_original.jpg"
     }
    ]
   }
  },

1 个答案:

答案 0 :(得分:0)

这里有三个问题:

  1. 您的代码未显示任何尝试访问datepublished成员
  2. 的行为
  3. 查看示例回复,我们可以看到datepublished,而不是publisheddate
  4. thumbnailurl成员不在metatags但在newsarticle
  5. 我怀疑,如果您只是花费更多时间来注意正确访问该对象,那么您的代码确实会抢占各种可能的响应,您在这方面的所有问题都将得到解决。