So erhalten Sie Youtube-Trends von am beliebtesten oder am häufigsten gesehen nach Land in Json.
Zuvor wurden YouTube-Feeds v2 verwendet. Es scheint veraltet zu sein, https://gdata.youtube.com/feeds/api/standardfeeds/IN/most_popular?v=2
Kann ich youtube api v3 oder ein anderes Ergebnis wie das Trends-Dashboard erhalten? https://www.youtube.com/trendsdashboard
Gemäß den YouTube-Richtlinien ist YouTube Feeds v2 jetzt veraltet. Sie sollten mit YouTube Data API v3 arbeiten.
Für das beliebteste Video:
Teil :
id, snippet, contentDetails, fileDetails, liveStreamingDetails, localizations, player, processingDetails, recordingDetails, statistics, status, suggestions, and topicDetails
Diagramm :
mostPopular
regionCode :
Taste :
maxResults : Standardwert 5,
var maxVideos = 5;
$(document).ready(function(){
$.get(
"https://www.googleapis.com/youtube/v3/videos",{
part: 'snippet',
chart: 'mostPopular',
kind: 'youtube#videoListResponse',
maxResults: maxVideos,
regionCode: 'IN',
key: 'Your_KEY_Here'},
function(data){
var output;
$.each(data.items, function(i, item){
console.log(item);
videTitle = item.snippet.title;
description = item.snippet.description;
thumb = item.snippet.thumbnails.high.url;
channelTitle = item.snippet.channelTitle;
videoDate = item.snippet.publishedAt;
Catagoryid = item.snippet.categoryId;
cID = item.snippet.channelId;
output = '<div class="maindiv"><div>' +
'<a data-fancybox-type="iframe" class="fancyboxIframe" href="watch.php?v=' + vidId + '" target="_blank" ><img src="' + thumb + '" class="img-responsive thumbnail" ></a>' +
'</div>' +
'<div class="input-group col-md-6">' +
'<h3 class="Vtitle"><a data-fancybox-type="iframe" class="fancyboxIframe" href="watch.php?v=' + vidId + '" target="_blank">' + videTitle + '</a></h3>'+
'</div><div id="cTitle"><a href="https://www.youtube.com/channel/'+cID+'" target="_blank">'+channelTitle+'</a></div></div>' +
'<div class="clearfix"></div>';
$('#trending').append(output);
})
}
);
});
Datei speichern als .js
Und in der Datei HTML
mache div
oder ul
durch id="trending"
mögen:
<div id="catagoryname"><h1>Trending</h1></div>
<ul id="trending"></ul>
Das check your out put.
API KEY
zu ersetzen.