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

  • HER0R

    HER0R

    16 Aralık 2007
  • Microsoft Research

    Microsoft Re

    24 EKİM 2008
  • mist64

    mist64

    30 Mayıs 2006