Tuesday, August 14, 2012

How To Show YouTube Activity Feed On Your Blogger

This is nice widget for your blog. It will help you to show your YouTube activity feed on your blogger.Follow these steps to add it to your blog.

1. Log in to blogger  Design > Page Element.

2. Click Add Gadget and select 'HTML/Javascript

3.Now Paste Below code.

<script src='http://code.jquery.com/jquery-latest.js' type='text/javascript'></script>
    <style type="text/css">
    div.ytc {clear:both;padding:5px;font-size:11px;}
    div.ytc.odd {background-color: #eee;}
    div.ytc_thumb {position:relative;float:right;margin-left:4px;line-height:1;}
    div.ytc_thumb img {width:69px;height:52px;border:1px solid #888;}
    div.ytc_title {font-weight:bold;}
    </style>
    <script type='text/javascript'>
    var ytfUserName = "YouTube Username";
    var ytfMaxResults = 8;
    var ytfAllow = "";
    var ytfDisallow = "";
    var ytfEmpty = "No entries";

    $(document).ready(function() {
      $.getJSON("http://pipes.yahoo.com/pipes/pipe.run?_id=58c841d14337ba4fbf693abd9701dc49&_render=json&max-results="+ytfMaxResults+"&allow="+ytfAllow+"&disallow="+ytfDisallow+"&user="+ytfUserName+"&_callback=?", function(response) {
        var htm = "";
        for(var i=0;i<response.count;i++) {
          var item = response.value.items[i];
          htm += '<div class="ytc';
          if(i%2 == 1) htm += ' odd';
          htm += '"><div class="ytc_thumb"><a target="_blank" href="' + item.link + '"><img title="' + item.title + '" src="' + item.thumb + '"/></a></div>';
          htm += '<div class="ytc_title"><a target="_blank" href="' + item.link + '">' + item.title + '</a></div>';
          htm += '<div class="ytc_description">' + item.description + '</div><div style="clear:both;"></div></div>';
        }
        if(htm == "") htm = ytfEmpty;
        $("#ytfeed").html(htm);
      });
    });
    </script>
    <div id="ytfeed">Loading...</div>



After paste above code
* Replace YouTube Username with your youtube username.

4. Now save your HTML/Javascript'.

    You are done...

1 comment:

  1. Nice! I might try this. :)

    ~Chai
    http://chenmeicai.blogspot.com

    ReplyDelete