0
API v3を使用して1つのYouTubeプレイリストを取得し、そのタイトルをすべて表示するにはどうすればよいですか?API v3を使用して1つのYouTubeプレイリストを取得し、トップ10のビデオタイトルをすべて表示するにはどうすればよいですか?
私はすでにビデオタイトルですが、プレイリストはありません。 私は行方不明の人がいる場合、誰かが何らかの質問を共有しています。 私の要件は、1つのYouTubeプレイリストのビデオタイトルです。
私はすべてのチャンネルのビデオタイトルを取得しています。何が欠けている?
var channelname = 'mipaltan';
$(document).ready(function() {
$.get("https://www.googleapis.com/youtube/v3/channels", {
part: 'contentDetails',
forUsername: 'mipaltan',
key: 'AIzaSyCT8kXaxJ2l29vYg4HBdYy36H-PhAH-Teg'
},
function (data) {
$.each(data.items, function (i, item) {
pid = item.contentDetails.relatedPlaylists.uploads;
getVids(pid);
})
}
);
function getVids(pid) {
$.get("https://www.googleapis.com/youtube/v3/playlistItems", {
part: 'snippet',
maxResults: 10,
playlistId: pid,
key: 'AIzaSyCT8kXaxJ2l29vYg4HBdYy36H-PhAH-Teg'
},
function (data) {
$.each(data.items, function (i, item) {
vidsTitle = item.snippet.title;
output = '<li>' + vidsTitle + '</li>';
// Append to results
$('#results').append(output);
})
}
);
}
});
<title> Get Video Title</title>
<style>
body {
background: #f4f4f4;
font-family: Arial, sans-serif;
font-size: 14px;
color: #666;
}
#container {
width: 100%;
height: auto;
overflow: auto;
margin: auto;
padding: 5px;
}
#container2 {
width: 100%;
height: auto;
overflow: auto;
margin: auto;
padding: 15px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/script.js"></script>
<script>
function newSrc(testurl) {
document.getElementById("MyFrame").src = testurl;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="container2"></div>
<iframe id="MyFrame"; width="220"; height="160"; src="http://www.youtube.com/embed?listType=playlist&list=PLVB7Pe64pVdd0RwAOTy7K4pm7TMAK1fQq" frameborder="0" allowfullscreen ></iframe>
<div style="padding-left:5px", id="result" class ="footer-widget"> </div>
<div id="container">
<ul id="results"></ul>
</div>
</form>
</body>
</html>
おかげであなたのための時間アニッシュは、一つのことは、あなたは、プレイリストのビデオのタイトルを参照し、下部タイトルの両方が異なっています。私はプレイリストのタイトルとボトムのタイトルは同じですが、今は違う、私は両方が同じです。 –
もう一度コードを調べると、リクエストから返されるプレイリストIDがiframeのidと一致していないことがわかりました。 playlistId変更してください:PID、 にplaylistId: "PLVB7Pe64pVdd0RwAOTy7K4pm7TMAK1fQq"、getVids上 が,,, –
おかげアニッシュ機能を –