Thứ Sáu, 30 tháng 3, 2012

Cách đem thật nhiều YouTube videos về blog của bạn

Bạn,

Hôm nay tôi muốn chia xẻ với bạn một "bí kiếp" mà tôi đã dùng để "lôi" về các videos từ một user account rồi post lên trang hoctroviet. Rất tiện lợi nếu bạn muốn xem video mà không phải xem quảng cáo từ những trang nhạc như AbbaVEVO chẳng hạn. Bạn cũng có thể đem về rồi góp những bài hay lại thành một tuyển chọn.







Bước 1:Tạo một blog mới, chỉ với mục đích là "lôi" đồ nhà người ta về, rồi chèn đoạn mã này vào đằng trước thẻ "</head>".



<script type='text/javascript'>

var yt = {
nComments : -1,
totCount : 0,
increment : 25,
queryDefault : 25,
web : &#39;&#39;,
ytDiv : &#39;&#39;,



ytQuery:function(query, ytD, start, increment, func) {
this.web = query;
this.ytDiv = ytD;

var script = document.createElement(&#39;script&#39;);

script.setAttribute(&#39;src&#39;, &#39;http://gdata.youtube.com/feeds/api/videos?q=&#39; + query + &#39;&amp;alt=json&#39;
+ &#39;&amp;callback=&#39; + func );
script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);
document.documentElement.firstChild.appendChild(script);
},


ytsearch:function(query, ytD, start, increment, func) {
this.web = query;
this.ytDiv = ytD;
var script = document.createElement(&#39;script&#39;);

script.setAttribute(&#39;src&#39;, &#39;http://gdata.youtube.com/feeds/api/users/&#39; + query + &#39;/uploads?alt=json&amp;start-index=&#39;
+ start + &#39;&amp;max-results=&#39; + increment
+ &#39;&amp;callback=&#39; + func );
script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);
document.documentElement.firstChild.appendChild(script);
},



// getLink return a href link if &quot;name&quot; matches the content inside &quot;a&quot; tags) of the link
getLink: function(entry, name) {
var alturl;

for (var k = 0; k &lt; entry.link.length; k++) {
if (entry.link[k].rel == name)
alturl = entry.link[k].href;
}
return alturl;
},



// getContent gets the content inside an entry of a json object.

getContent: function(entry) {
return entry.content.$t;
},


//
getTitle: function(entry) {
return entry.title.$t;
},



//
getAuthorName: function(entry) {
return entry.author.name.$t;
},

//

getYTLink: function(entry) {
return &quot;http://www.youtube.com/watch?v=&quot; + this.getID(entry);
},

//
getYTLinkPlaylist: function(entry) {
return &quot;http://www.youtube.com/watch?v=&quot; + this.getIDPlaylist(entry);
},

//

getIDPlaylist: function(entry) {
  var id = entry.link[0].href.substr(entry.link[0].href.length - 33,entry.link[0].href.length - 22);
  return id.substr(0,11);
},

//
getID: function(entry) {
  var id = entry.id.$t;
  return id.substr(id.length - 11, id.length - 1);
},



// getTotalResults needs the json object, and it&#39;ll return the total number of comments (or posts) of the blog.

getTotalResults: function(json) {
return json.feed.openSearch$totalResults.$t;
},



// getStartIndex gets the start index of a search inside an json object.
getStartIndex: function(json) {
return json.feed.openSearch$startIndex.$t;
},



listBatch : function (json, tag) {

  var text=&quot;&quot;;
  var p = document.createElement(&#39;div&#39;);
  var ul = document.createElement(&#39;ul&#39;);

for (var i = 0; i &lt; json.feed.entry.length; i++) {
    var entry = json.feed.entry[i];

text = &#39;&lt;li class= &quot;playlist-video-item &quot;&gt;&#39; +

&#39;&lt;a href=&quot;http://www.youtube.com/watch?v=&#39; + this.getID(entry) + &#39;&quot; class= &quot;tile-link-block video-tile &quot;&gt;&#39; +

&#39;&lt;span class=&quot;playlist-video-item-base-content&quot;&gt;&#39; +

&#39;&lt;span class=&quot;thumb-container&quot;&gt;&#39; +

&#39;&lt;span class=&quot;ux-thumb-wrap&quot;&gt;&#39; +

&#39; &lt;span class=&quot;video-thumb ux-thumb ux-thumb-114 &quot;&gt;&#39; +

&#39;&lt;span class=&quot;clip&quot;&gt;&#39; +

&#39;&lt;span class=&quot;clip-inner&quot;&gt;&#39; +

&#39;&lt;img src=&quot;http://i2.ytimg.com/vi/&#39; +

 this.getID(entry) +

&#39;/default.jpg&quot; &gt;&lt;span class=&quot;vertical-align&quot;&gt;&#39; +

&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&#39; +

&#39;&lt;span class=&quot;video-info&quot;&gt;&lt;span class=&quot;video-overview&quot;&gt;&lt;span class=&quot;title video-title &quot;  dir=&quot;ltr&quot; &gt;&#39; +

this.getTitle(entry) +

&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&#39; +

&#39;&lt;/a&gt;&lt;/li&gt;&#39;;


  var li = document.createElement(&#39;li&#39;);
  var a = document.createElement(&#39;a&#39;);
  a.href = this.getYTLink(entry);
  a.target =  &quot;_blank&quot;;

  var txt = document.createTextNode(text);
  a.appendChild(txt);
  li.appendChild(a);
  ul.appendChild(li);
  }

  p.appendChild(ul);
  document.getElementById(tag).appendChild(p);

},



callJson : function(json) {
  this.listBatch(json, this.ytDiv);
},



getCo : function(json) {
  this.totCount = this.getTotalResults(json);
  var count =  (this.nComments &lt; 0) ? this.totCount : this.nComments;
  var i=1;
  while( i &lt;= count ) {
    var incr = (count-i &lt; this.increment) ? count-i+1 : this.increment;
    this.ytsearch( this.web, this.ytDiv, i, incr, &#39;yt.callJson&#39;);
    if (incr==0) incr=incr+1;
    i = i+incr;
  }
},


Channel:function(query, ytD) {
this.web = query;
this.ytDiv = ytD;
this.ytsearch(query, ytD, 1,20,&#39;yt.getCo&#39;);
}

};

</script>



Bước 2: Tạo ra một bài viết mới bằng cách thêm vào đoạn sau. Thế chữ in đậm(AbbaVEVO) với tên (YouTube username) của người mà bạn muốn đem videos của họ về. Nhớ đem vào bằng cách "HTML" chứ đừng bằng cách  "chữ đẹp" (compose).



<div id="yt2012">

</div>

<script type='text/javascript'>

yt.Channel( 'AbbaVEVO', 'yt2012');

</script>



Bước 3: đăng bài lên.  Đoạn mã tôi viết sẽ đến username account đó, rồi lôi hết các videos về, 10, 100, 1000 videos nó cũng lôi về hết!





Lấy nội dung của post bằng cách cắt rồi dán vào notepad (Ctrl+A, mở notepad, rồi Ctrl+V)

Bây giờ ta trở qua blog chính.

Trước hết, nếu bạn muốn xem videos ngay trên trang nhà, giống như cách hoctro làm trên trang hoctroviet, thì thêm đoạn mã này trước thẻ </head> :


<!-- Yahoo Media Player -->

<script src='http://webplayer.yahooapis.com/player.js' type='text/javascript'/>





Sau đó, tạo ra một bài viết mới, rồi chuyển qua dạng viết HTML. Thêm vào <ul></ul> rồi nhét đoạn mã mới thu hoạch vào giữa hai thẻ đó.


Đăng bài lên! Bạn sẽ thấy hết các bài nhạc từ trang muốn lấy về. Thí dụ như trang AbbaVEVO dưới đây.




Đây là cách tôi đem videos về trang hoctroviet từ hơn năm nay. Hy vọng bạn sẽ có dịp thử làm theo.

Chúc vui!

Hoctro
3/30/2012

Chủ Nhật, 18 tháng 3, 2012

I'm Still Alive - Một bản nhạc hiếm và quý của Agnetha Faltskog

Bạn,

Nhân trả lời một comment của bạn Linh về Agnetha Faltskog, tôi lò mò vào tủ sách và lôi ra quyển "As I Am", tiểu sử tự thuật của nàng, thì khám phá ra một điều thú vị là nàng cũng đã soạn nhạc, và tự đệm đàn piano trong chuyến trình diễn Bắc Mỹ, Anh quốc, và Nhật Bản năm 1979! Ban ABBA chưa hề thu âm bản này, do đó lại càng quý và hiếm hơn nữa. Như mọi khi, tôi lên Google tìm kiếm, và đã được nghe bản này, do một fan soạn lại từ một bootleg copy, rồi nghe và chép lời lên. Những ai là ABBA fan nên coi đây là một khám phá kỳ bí, vì như thế là ban nhạc có tới 4 người biết viết nhạc và được chơi nhạc chứ không phải là chỉ có Benny, Bjorn, và Stig Andersson.

Sau đây là video.




I'm Still Alive
(Written and performed by Agetha Faltskog)

I was a loser then
But I'm a winner now
I'd do it all again
cause now I know how
How everything in life comes down to this, at last
Surviving, and living
determined not to give in
And I'm still alive, my life is rolling on
Gently from day to day.
Memories will fade away
Yes I'm still alive, the agony is gone
And my mind is slowly waking
And my heart has ceased its aching
I'm still alive

I took so many blows
I cried a sea of tears
And only heaven knows
How I could stand the fear
I think of all the nights
I layed alone and scared
And shattered, and crying
And thinking I was dying
But I'm still alive, my life is rolling on
Gently from day to day.
Memories will fade away
Yes I'm still alive, the agony is gone
And my mind is slowly waking
And my heart has ceased its aching
I'm still alive

Yes I'm still alive, my life is rolling on
Gently from day to day.
Memories will fade away
Yes I'm still alive, the agony is gone
And my mind is slowly waking
And my heart has ceased its aching
I'm still alive

Ngay từ câu đầu đã thấy chọi với lời nhạc của bài "The Winner Takes It All" (do Bjorn - chồng cũ - đặt lời),  khi nàng cất tiếng hát "I'm a loser then, but I'm a winner now ...".

Một tin tức khác cũng liên quan tới ABBA là họ sẽ cho ra đĩa Deluxe của LP The Visitors tháng tư này, với nhiều "alternative takes" khác.





Đây là đĩa tôi thích nhất của ABBA, nên chắc sẽ phải tìm mua. Theo như comment của một fan thì:


"@Perle3456: It is going to be a 9min medley of 5 demo/alternate versions of 'like an angel passing through my room'. Including the first demo with Bjorn on lead vocals, an alternate lyric version called 'another morning without you', a disco version with A&F on vocals, another version with full backing track and A&F on vocals and a final run through with Frida on lead and Benny on piano, similar to the final released version. Exciting times ahead!"

5 bản khác nhau của "Like an Angel Passing Through My Room"! Nếu bạn biết bản này rồi thì chắc cũng sẽ hồi hộp chờ nghe các alternative takes của chúng như tôi. 

Girls Generation - Korean