Created
October 10, 2010 18:47
-
-
Save ikikko/619452 to your computer and use it in GitHub Desktop.
g100pon #8 Ustream API
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
// 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