Created
July 27, 2014 13:09
-
-
Save shirayuca/204a9d3a269dc8dde883 to your computer and use it in GitHub Desktop.
Googleイメージ検索トップの抽出
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTopImageUrl(query) { | |
var url = 'http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=' + encodeURI(query); | |
var response = UrlFetchApp.fetch(url); | |
var json = response.getContentText(); | |
var object = Utilities.jsonParse(json); | |
return object["responseData"]["results"][0]["unescapedUrl"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment