D

유트브영상 순간검색 구현

· 14년 전 · 2011 · 9
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="history" content="">
<meta name="author" content="dokjin@gamil.com">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<title>유트브 순간검색</title>
<script type="text/javascript">
$(document).ready(function()
{

$(".search_input").keyup(function()
{
var search_input = $(this).val();
var keyword= encodeURIComponent(search_input);
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';
$.ajax
({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
var video_frame="<iframe width='640' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";
var final="<div id='title'>"+video_title+"</div><div>"+video_frame+"</div><div id='count'>"+video_viewCount+" Views</div>";
$("#result").html(final); // Result
});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
});
});
function yts(search_input){
var keyword= encodeURIComponent(search_input);
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';
$.ajax
({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{
if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
var video_frame="<iframe width='640' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";
var final="<div id='title'>"+video_title+"</div><div>"+video_frame+"</div><div id='count'>오늘까지뷰 "+video_viewCount+" Views</div>";
$("#result").html(final); // Result
});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
}
yts('Empire State of Mind');
</script>
</head>
<body>
<div id="wrap">
<h2>DOKJIN PLAY GROUND</h2>
<div id="result"></div>
<h2>검색어를 입력하세요 <input type="text" class='search_input' /> </h2>
<br />
<h2><a href="#" onclick="yts('아이유');">onclick="yts('아이유');"</a></h2>
<ul>
</div>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>

첨부파일

youtube.html (2.7 KB) 86회 2011-07-13 13:31
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 1,589
14년 전 조회 695
14년 전 조회 919
14년 전 조회 969
14년 전 조회 1,324
14년 전 조회 936
14년 전 조회 1,232
14년 전 조회 3,179
14년 전 조회 1,551
14년 전 조회 949
14년 전 조회 1,725
14년 전 조회 1,100
14년 전 조회 627
14년 전 조회 2,518
14년 전 조회 924
14년 전 조회 988
14년 전 조회 1,289
14년 전 조회 1,152
14년 전 조회 1,191
14년 전 조회 734
14년 전 조회 2,613
14년 전 조회 1,012
14년 전 조회 1,634
14년 전 조회 1,305
14년 전 조회 1,311
14년 전 조회 1,048
14년 전 조회 1,312
14년 전 조회 885
14년 전 조회 913
14년 전 조회 1,743
14년 전 조회 1,499
14년 전 조회 1,301
14년 전 조회 1,353
14년 전 조회 2,058
14년 전 조회 1,645
14년 전 조회 809
14년 전 조회 1,651
14년 전 조회 1,430
14년 전 조회 1,496
14년 전 조회 993
14년 전 조회 1,026
14년 전 조회 983
14년 전 조회 971
14년 전 조회 1,583
14년 전 조회 920
14년 전 조회 1,223
14년 전 조회 1,491
14년 전 조회 1,561
14년 전 조회 1,222
14년 전 조회 2,012
14년 전 조회 1,338
14년 전 조회 1,969
14년 전 조회 1,529
14년 전 조회 1,166
14년 전 조회 3,239
14년 전 조회 1,691
14년 전 조회 1,155
14년 전 조회 1,015
14년 전 조회 1,724
14년 전 조회 1,115
14년 전 조회 894
14년 전 조회 849
14년 전 조회 2,091
14년 전 조회 760
14년 전 조회 985
14년 전 조회 1,764
14년 전 조회 1,089
14년 전 조회 1,094
14년 전 조회 1,650
14년 전 조회 1,294
14년 전 조회 1,368
14년 전 조회 1,159
14년 전 조회 2,461
14년 전 조회 1,256
14년 전 조회 954
14년 전 조회 1,149
14년 전 조회 910
14년 전 조회 938
14년 전 조회 793
14년 전 조회 981
14년 전 조회 1,363
14년 전 조회 1,583
14년 전 조회 1,082
14년 전 조회 1,211
14년 전 조회 1,054
14년 전 조회 1,250
14년 전 조회 1,513
14년 전 조회 1,286
14년 전 조회 1,520
14년 전 조회 1,256
14년 전 조회 1,182
14년 전 조회 1,208
14년 전 조회 1,174
14년 전 조회 1,701
14년 전 조회 1,667
14년 전 조회 1,454
14년 전 조회 1,547
14년 전 조회 1,782
14년 전 조회 778
14년 전 조회 1,239