2016-01-19 76 views

回答

0

我最近實現了Google Search JSON API,根據我的理解,獲取網站鏈接的唯一方法是通過JSON回調,其中每個結果都包含formattedUrl或htmlFormattedUrl。查詢將是有問題的網站,並希望第一個結果會給你網站的相關鏈接。

但是,如果我正確理解你的問題,你想要廢除給定網站的子鏈接,這是web crawler會做的事情。如果你是網站的所有者,你可以在網絡上使用許多工具創建一個網站地圖,但是如果你的意圖可以被歸類爲「其他」,那麼我相信你會在錯誤的樹上咆哮。請參閱question,它將指出您創建一個簡單的WebCrawler。

//示例customsearch#查詢結果中的結果項目Deovandski

"items": [ 
    { 
    "kind": "customsearch#result", 
    "title": "Student Experience - College of Science and Mathematics (NDSU)", 
    "htmlTitle": "Student Experience - College of Science and Mathematics (NDSU)", 
    "link": "https://www.ndsu.edu/scimath/currentstudents/student_experience/", 
    "displayLink": "www.ndsu.edu", 
    "snippet": "Sep 16, 2015 ... Association for Computing Machinery Student Chapter Chair: Jordan Goetze \nAdvisor: Brian Slator. Upsilon Pi Epsilon President: Deovandski ...", 
    "htmlSnippet": "Sep 16, 2015 \u003cb\u003e...\u003c/b\u003e Association for Computing Machinery Student Chapter Chair: Jordan Goetze \u003cbr\u003e\nAdvisor: Brian Slator. Upsilon Pi Epsilon President: \u003cb\u003eDeovandski\u003c/b\u003e ...", 
    "cacheId": "pyzF9XJwrXsJ", 
    "formattedUrl": "https://www.ndsu.edu/scimath/currentstudents/student_experience/", 
    "htmlFormattedUrl": "https://www.ndsu.edu/scimath/currentstudents/student_experience/", 
    "pagemap": { 
    "cse_image": [ 
    { 
     "src": "https://www.ndsu.edu/fileadmin/_processed_/csm_080117_anatomy_03med_9dbc3c8cce.jpg" 
    } 
    ], 
    "cse_thumbnail": [ 
    { 
     "width": "184", 
     "height": "275", 
     "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTTL-GZRfSv30cyESsCnd_65BFoLMDdo8fqNS58mHfRbGiOTjSq-e-o28FE" 
    } 
    ] 
    } 
    }, 
相關問題