1 / 26

Google API

Google API. 義守大學資訊工程學系 歐陽振森 ouyangcs@isu.edu.tw. Google 服務. Google Search Gmail Google Maps Google Earth Google News Google Image Search Google Book Search Google Blog Search. Google Notebook Google Desktop Google Toolbar Google 學術搜尋 Google 大學搜尋 Google Alerts YouTube

adriel
Télécharger la présentation

Google API

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Google API 義守大學資訊工程學系 歐陽振森 ouyangcs@isu.edu.tw

  2. Google 服務 • Google Search • Gmail • Google Maps • Google Earth • Google News • Google Image Search • Google Book Search • Google Blog Search

  3. Google Notebook • Google Desktop • Google Toolbar • Google 學術搜尋 • Google 大學搜尋 • Google Alerts • YouTube • Google Calendar

  4. orkut • Picasa • Google Docs • Blogger • Google Talk • Google Groups • Google Reader • Google SketchUp

  5. Google Analytics • Google Translate • Google Video • Google Trends • Google Code Search • Google Patent Search • Google AdSense • Google Adwords • Google Page Creator

  6. API • Application Programming Interface: API是一組作為應用程式呼叫某個功能與服務的函數。程式設計師可依據API函數撰寫程式,讓作業系統或某個程式啟動某個程式以執行特定的功能。 • 應用程式 • 介面 • 根據API定義的方式呼叫相對應的功能

  7. Google API (1) • Android • Google AJAX Search API • Google APP Engine • Google Calendar API • Google Chart API • Gadgets • Google Gears • Google Maps API

  8. Google API (2) • OpenSocial • YouTube API • Google Data API • Blogger API • Google AJAX Feed API

  9. 簡介 • Google搜尋服務之包裝 • 由JavaScript所構成的函式庫 • 可放在自己的網站或部落格中 • 服務範圍:網頁搜尋、本地搜尋、影片搜尋、部落格搜尋、新聞搜尋、書籍搜尋、圖片搜尋 • 組成元件:搜尋控制器、搜尋器、搜尋結果物件、額外的設定物件 • 專屬論壇:Google AJAX Search API論壇

  10. Google AJAX Search API Key • 須先申請Google AJAX Search API key • 申請網址:http://code.google.com/intl/zh-TW/apis/ajaxsearch/signup.html

  11. 程式範例一 • 範例一:HelloWorld.html

  12. 搜尋控制容器 • 用來裝載搜尋功能的容器 • 所有搜尋功能的物件必須放入這個容器才能運作 • 包含兩種物件: • google.search.SearchControl • google.search.SearchForm

  13. Google.search.SearchControl • 建立物件 • var searchControl = new google.search.SearchControl; • 加入搜尋器 • addSearcher(searcher,opt_options) • 搜尋器: • google.search.WebSearch (網頁搜尋) • google.search.LocalSearch(當地搜尋) • google.search.VideoSearch (影片搜尋) • google.search.BlogSearch (部落格搜尋) • google.search.NewsSearch (新聞搜尋) • google.search.BookSearch (書籍搜尋) • google.search.ImageSearch (圖片搜尋)

  14. Google.search.SearchControl • 練習一 • 請將各種搜尋器加入範例一中。 • 搜尋界面繪製 • draw(element, GdrawOptions) • 執行關鍵字搜尋 • execute(str) • 練習二 • 請用自己的名字當關鍵字來搜尋。

  15. Google.search.SearchControl • 搜尋不到結果時,網頁所顯示之文字 • setNoResultsString(str) • 練習三 • 請設定當搜尋不到結果,網頁顯示”Google太遜了啦”。

  16. Google.search.SearchForm • 建立物件 • var searchForm = new google.search.SearchForm(enableClear,element); • 設定點選搜尋按鈕後所呼叫的物件與函式 • setOnSubmitCallback(object,method) • 範例二:2-12.html

  17. Google.search.SearchForm • 設定點選搜尋輸入欄位的清除按鈕後所呼叫的物件與函式 • setOnClearCallback(object,method) • 範例三:2-13.html • 設定搜尋關鍵字 • execute(query) • 練習四 • 請設定點選搜尋輸入欄位的清除按鈕後彈出一個視窗顯示搜尋關鍵字”自己的名字”。

  18. 網頁搜尋器 • 建立物件 • var searcher=new google.search.WebSearch(); • 限制所要搜尋的對象 • setSiteRestriction(site,refinement,moreResults) • 範例四:2-15.html • 對搜尋結果進行過濾 • setRestriction(type,opt_value) • type: google.search.Search.RESTRICT_SAFESEARCH • opt_value: google.search.Search.SAFESEARCH_STRICT google.search.Search.SAFESEARCH_MODERATE google.search.Search.SAFESEARCH_OFF

  19. 本地搜尋器 • 建立物件 • var searcher=new google.search.LocalSearch(); • 針對特定地理區域進行搜尋 • setCenterPoint(location) • 範例五:2-17.html • 是否要針對地址進行搜尋 • setAddressLookupMode(mode) • mode: google.search.LocalSearch.ADDRESS_LOOKUP_DISABLED google.search.LocalSearch.ADDRESS_LOOKUP_ENABLED

  20. 影片搜尋器 • 建立物件 • var searcher=new google.search.VideoSearch(); • 搜尋結果的排序順序 • setResultOrder(orderBy) • orderBy: google.search.Search.ORDER_BY_RELEVANCE google.search.Search.ORDER_BY_DATE

  21. 部落格搜尋器 • 建立物件 • var searcher=new google.search.BlogSearch(); • 限制所要搜尋的對象 • setSiteRestriction(site) • 搜尋結果的排序順序 • setResultOrder(orderBy) • orderBy: google.search.Search.ORDER_BY_RELEVANCE google.search.Search.ORDER_BY_DATE

  22. 新聞搜尋器 • 建立物件 • var searcher=new google.search.NewsSearch(); • 限制所要搜尋的對象 • setSiteRestriction(site) • 搜尋結果的排序順序 • setResultOrder(orderBy) • orderBy: google.search.Search.ORDER_BY_RELEVANCE google.search.Search.ORDER_BY_DATE

  23. 書籍搜尋器 • 建立物件 • var searcher=new google.search.BookSearch(); • 對搜尋結果進行過濾 • setRestriction(type,opt_value) • type: google.search.Search.RESTRICT_TYPE • opt_value: google.search.BookSearch.TYPE_FULL_VIEW_BOOKS google.search.BookSearch.TYPE_ALL_BOOKS

  24. 圖片搜尋器 • 建立物件 • var searcher=new google.search.ImageSearch(); • 對搜尋結果進行過濾 • setRestriction(type,opt_value) • type: google.search.Search.RESTRICT_SAFESEARCH google.search.ImageSearch.RESTRICT_IMAGESIZE google.search.ImageSearch.RESTRICT_COLORIZATION google.search.ImageSearch.RESTRICT_FILETYPE google.search.ImageSearch.RESTRICT_IMAGETYPE

  25. 圖片搜尋器 • opt_value • google.search.Search.RESTRICT_SAFESEARCH • google.search.Search.SAFESEARCH_STRICT • google.search.Search.SAFESEARCH_MODERATE • google.search.Search.SAFESEARCH_OFF • google.search.ImageSearch.RESTRICT_IMAGESIZE • google.search.ImageSearch.IMAGESIZE_SMALL • google.search.ImageSearch.IMAGESIZE_MDEIUM • google.search.ImageSearch.IMAGESIZE_LARGE • google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE

  26. 圖片搜尋器 • google.search.ImageSearch.RESTRICT_COLORIZATION • google.search.ImageSearch.COLORIZATION_BLACK_AND_WHITE • google.search.ImageSearch.COLORIZATION_GRAYSCALE • google.search.ImageSearch.COLORIZATION_COLOR – • google.search.ImageSearch.RESTRICT_FILETYPE • google.search.ImageSearch.FILETYPE_JPG • google.search.ImageSearch.FILETYPE_PNG • google.search.ImageSearch.FILETYPE_GIF • google.search.ImageSearch.FILETYPE_BMP • google.search.ImageSearch.IMAGETYPE_FACES • google.search.ImageSearch.IMAGETYPE_FACES

More Related