Skip to content

Instantly share code, notes, and snippets.

@ikikko
Created October 10, 2010 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikikko/619452 to your computer and use it in GitHub Desktop.
Save ikikko/619452 to your computer and use it in GitHub Desktop.
g100pon #8 Ustream API
// g100pon #8 Ustream API
// Ustream Developer Network : http://developer.ustream.tv/
// 本来なら http://developer.ustream.tv/apikey/generate で
// APIキーを取得する必要があるはずだが
// キーを指定しなくともAPIを使用することができた
def key = 'yourDevKey'
// Ustream APIのパラメータ
def format = 'xml' // [ xml | json | html | php ]
def subject = 'channel' // [ channel | user | video | stream | system ]
def uid = 'all' // [ subject UID | scope ]
def command = 'search'
def params = 'title:like:jggug'
// アクセス先のURL
def url = "http://api.ustream.tv/${format}/${subject}/${uid}/${command}/${params}?key=${key}"
// GETでアクセスして、取得結果のXMLをパース
def xml = new XmlParser().parse(url)
xml.results.array.each {
// 検索結果のタイトルとUstream URLを出力
println it.title.text() + " : " + it.url.text()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment