D

유트브영상 순간검색 구현

· 14년 전 · 1867 · 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,465
14년 전 조회 583
14년 전 조회 783
14년 전 조회 842
14년 전 조회 1,202
14년 전 조회 816
14년 전 조회 1,104
14년 전 조회 3,045
14년 전 조회 1,416
14년 전 조회 804
14년 전 조회 1,601
14년 전 조회 969
14년 전 조회 506
14년 전 조회 2,392
14년 전 조회 787
14년 전 조회 847
14년 전 조회 1,156
14년 전 조회 1,028
14년 전 조회 1,066
14년 전 조회 596
14년 전 조회 2,473
14년 전 조회 885
14년 전 조회 1,505
14년 전 조회 1,179
14년 전 조회 1,187
14년 전 조회 889
14년 전 조회 1,185
14년 전 조회 754
14년 전 조회 781
14년 전 조회 1,605
14년 전 조회 1,359
14년 전 조회 1,169
14년 전 조회 1,216
14년 전 조회 1,943
14년 전 조회 1,524
14년 전 조회 629
14년 전 조회 1,513
14년 전 조회 1,292
14년 전 조회 1,372
14년 전 조회 850
14년 전 조회 889
14년 전 조회 846
14년 전 조회 829
14년 전 조회 1,454
14년 전 조회 791
14년 전 조회 1,090
14년 전 조회 1,363
14년 전 조회 1,419
14년 전 조회 1,099
14년 전 조회 1,868
14년 전 조회 1,187
14년 전 조회 1,834
14년 전 조회 1,390
14년 전 조회 1,032
14년 전 조회 3,112
14년 전 조회 1,561
14년 전 조회 1,031
14년 전 조회 879
14년 전 조회 1,567
14년 전 조회 984
14년 전 조회 789
14년 전 조회 712
14년 전 조회 1,958
14년 전 조회 621
14년 전 조회 860
14년 전 조회 1,622
14년 전 조회 962
14년 전 조회 945
14년 전 조회 1,495
14년 전 조회 1,167
14년 전 조회 1,240
14년 전 조회 1,033
14년 전 조회 2,333
14년 전 조회 1,116
14년 전 조회 848
14년 전 조회 1,020
14년 전 조회 777
14년 전 조회 810
14년 전 조회 636
14년 전 조회 849
14년 전 조회 1,225
14년 전 조회 1,453
14년 전 조회 922
14년 전 조회 1,079
14년 전 조회 928
14년 전 조회 1,110
14년 전 조회 1,384
14년 전 조회 1,152
14년 전 조회 1,354
14년 전 조회 1,126
14년 전 조회 1,057
14년 전 조회 1,087
14년 전 조회 1,034
14년 전 조회 1,567
14년 전 조회 1,510
14년 전 조회 1,317
14년 전 조회 1,417
14년 전 조회 1,653
14년 전 조회 649
14년 전 조회 1,100
🐛 버그신고