0
YouTube API v3を使用して情報を取得するjsファイルを作成しました。私は変更する時間を得るために多くの方法を試しましたが、何も動作しません。誰かが月/日/年に変更する方法を私に説明することはできますか?変更するYouTube動画の時刻形式を取得できません
ありがとうございます。
var channelName = '2kolf';
var vidWidth = 166;
var vidHeight = 86;
var vidResults = 4;
$ (document).ready(function() {
\t $.get(
\t \t "https://www.googleapis.com/youtube/v3/channels",{
\t \t \t part: 'contentDetails',
\t \t \t forUsername: channelName,
\t \t \t key: ''},
\t \t function(data) {
\t \t \t \t $.each(data.items, function(i, item) {
\t \t \t \t \t console.log(item);
\t \t \t \t \t pid = item.contentDetails.relatedPlaylists.uploads;
\t \t \t \t \t getVids(pid);
\t \t \t \t })
\t \t \t }
\t);
\t function getVids(pid){
\t \t $.get(
\t \t "https://www.googleapis.com/youtube/v3/playlistItems",{
\t \t \t part: 'snippet',
\t \t \t maxResults: vidResults,
\t \t \t playlistId: pid,
\t \t \t key: ''},
\t \t \t function(data) {
\t \t \t \t var output;
\t \t \t \t $.each(data.items, function(i, item) {
\t \t \t \t \t console.log(item);
videoTitle = item.snippet.title.replace("Season 8 - ", "");
\t \t \t \t \t videoId = item.snippet.resourceId.videoId;
\t \t \t \t \t videoThumbnails = item.snippet.thumbnails.medium.url;
\t \t \t \t \t videoPublished = item.snippet.publishedAt;//This is to show the date published//
\t \t \t \t \t videoAuthor = item.snippet.channelTitle.replace("2kOLF", "2K Online Franchise");
\t \t \t \t \t videoStats = item.snippet.statistics;
\t \t \t \t \t \t \t \t \t \t
output = '<li class="YouTubeVideos"><a class="various fancybox.iframe" title="'+videoTitle+'" href=\"//www.youtube.com/embed/'+videoId+'\?fs=1&autoplay=1"><img height="'+vidHeight+'" width="'+vidWidth+'" src='+videoThumbnails+' ></a><br><p>'+videoTitle+'</p><br><span style="font-weight: normal;">by '+videoAuthor+'<br>'+videoPublished+'</span></li>';
\t \t \t \t \t
\t \t \t \t \t //Append to results listStyleType
\t \t \t \t \t $('#results').append(output);
\t \t \t \t })
\t \t \t }
\t);
\t }
});
を表示する
使用
formattedDate
は、ご返信いただきありがとうございます。私はコードを変更し、あなたが言及したものを追加しました。しかし、私はエラーが発生します。 'ReferenceError:mydateが定義されていません。 – ssx95351