Quantcast
Channel: ATTRIP
Viewing all articles
Browse latest Browse all 10873

【javascript】任意のキーワードでyoutubeを検索して表示する方法

$
0
0

任意のキーワードでyoutubeを出す方法です。
自動でyoutubeから検索して表示さいたい場合に使えますよ。

youtube logo

 
<script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0" type="text/javascript"></script>
    <script type="text/javascript">
    // How to search through a YouTube channel aka http://www.youtube.com/members
 
    google.load('search', '1');
 
    function OnLoad() {
 
      // create a search control
      var searchControl = new google.search.SearchControl();
 
      // So the results are expanded by default
      options = new google.search.SearcherOptions();
      options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
 
      // Create a video searcher and add it to the control
      searchControl.addSearcher(new google.search.VideoSearch(), options);
 
      // Draw the control onto the page
      searchControl.draw(document.getElementById("content"));
 
      // Search for a YouTube channel
      searchControl.execute("ここにキーワード");
    }
 
    google.setOnLoadCallback(OnLoad);
    </script>
 
<div id="content"><b>ここにキーワード</b>のYouTube読み込み中...</div>
<!-- youtube end -->

apiキーは、googleから取りに行ってね!

ここにキーワードと書いたところに好きなキーワードを
sample
フジロック2013出演アーティスト | A!@attrip

http://attrip.jp/category/fujirock2013

スポンサードリンク



attripのサイトへ飛ぶ

http://attrip.jp/


Viewing all articles
Browse latest Browse all 10873

Trending Articles