SORU
25 Temmuz 2010, Pazar


Nasıl YouTube APİ ile video gösterim sayısı almak için?

Soru çok basit. Nasıl YouTube APİ ile video gösterim sayısı almak için?

enter image description here

Görev basit ama videoları bu sorgu çok sayıda çok sık kullanmak istiyorum. Kendi Youtube API çağrısı ve bunu almak için herhangi bir yolu var mı? (facebook gibi bir şey http://api.facebook.com/restserver.php?method=links.getStats&urls=developers.facebook.com)

CEVAP
25 Temmuz 2010, Pazar


En kolay yol bence, JSON formatında video bilgi elde etmektir. Eğer JavaScript kullanmak istiyorsanız, jQuery.getJSON(). Ama PHP tercih ederim deneyin:

<?php
$video_ID = 'your-video-ID';
$JSON = file_get_contents("https://gdata.youtube.com/feeds/api/videos/{$video_ID}?v=2&alt=json");
$JSON_Data = json_decode($JSON);
$views = $JSON_Data->{'entry'}->{'yt$statistics'}->{'viewCount'};
echo $views;
?>

İlan No: Youtube API - Retrieving information about a single video

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Amazon Web Services

    Amazon Web S

    8 NİSAN 2009
  • TotalxLuna

    TotalxLuna

    27 Kasım 2011
  • williamfitzsimmons

    williamfitzs

    14 Mart 2008