[GSoC 2013] Pranjal Prabhash's YouTube Plugin proposal

Pranjal Prabhash edited this page May 11, 2013 · 7 revisions


================ cURL, ZendFramework, PHP version > 5.0, MySQL



  1. Authentication

"The PHP client library can be used to retrieve public feeds or to execute authenticated operations. All public feeds are read-only and do not require any authentication. Authenticated operations, on the other hand, include the retrieval of private feeds, such as a user's inbox feed, as well as write, upload, update and delete operations. You will need to sign up for a developer key to be able to execute authenticated operations." - Source: https://developers.google.com/youtube/2.0/developers_guide_php#Authentication

  1. Once A User has been authenticated, we can retrieve a list of videos user "might" like. Hence a search can be created categorically based upon:

**Standard feed for a user: (Source: https://developers.google.com/youtube/2.0/reference#Standard_feeds)
**Region Specific Feed for a user (Source: https://developers.google.com/youtube/2.0/reference#Region_specific_feeds)
**Category specific Feed (source: https://developers.google.com/youtube/2.0/reference#Category_specific_standard_feeds)

  1. Feeds

The feed which we will get will consist of Views, Likes, Comments and more which can be seen from the code extract from Google Youtube ZendFramework GData API

function printVideoEntry($videoEntry)
// the videoEntry object contains many helper functions
// that access the underlying mediaGroup object
echo 'Video: ' . $videoEntry->getVideoTitle() . "\n";
echo 'Video ID: ' . $videoEntry->getVideoId() . "\n";
echo 'Updated: ' . $videoEntry->getUpdated() . "\n";
echo 'Description: ' . $videoEntry->getVideoDescription() . "\n";
echo 'Category: ' . $videoEntry->getVideoCategory() . "\n";
echo 'Tags: ' . implode(", ", $videoEntry->getVideoTags()) . "\n";
echo 'Watch page: ' . $videoEntry->getVideoWatchPageUrl() . "\n";
echo 'Flash Player Url: ' . $videoEntry->getFlashPlayerUrl() . "\n";
echo 'Duration: ' . $videoEntry->getVideoDuration() . "\n";
echo 'View count: ' . $videoEntry->getVideoViewCount() . "\n";
echo 'Rating: ' . $videoEntry->getVideoRatingInfo() . "\n";
echo 'Geo Location: ' . $videoEntry->getVideoGeoLocation() . "\n";
echo 'Recorded on: ' . $videoEntry->getVideoRecorded() . "\n";

//see the paragraph above this function for more information on the
// 'mediaGroup' object. in the following code, we use the mediaGroup
// object directly to retrieve its 'Mobile RSTP link' child
foreach ($videoEntry->mediaGroup->content as $content) {
if ($content->type === "video/3gpp") {
echo 'Mobile RTSP link: ' . $content->url . "\n";

echo "Thumbnails:\n";
$videoThumbnails = $videoEntry->getVideoThumbnails();

foreach($videoThumbnails as $videoThumbnail) {
echo $videoThumbnail['time'] . ' - ' . $videoThumbnail['url'];
echo ' height=' . $videoThumbnail['height'];
echo ' width=' . $videoThumbnail['width'] . "\n";

But this feed can only be obtained for an authenticated User's Video. To check whether the user "owns" the video, "getEditLink" method has to be called on that entry.

We can also get the number of likes and dislikes, thumbnails, user comments.

  1. Utilizing Data (Insights)

  • We can have a graphical structure just like Git has where we can put the X-Axis as the time frame in Days/months/years, while keeping the Y-Axis as a stage below what X-axis is. Say X-Axis is in years, then We can put Y-Axis in months. Different colors will identify the number of views.

Alt text

I am fond of this description of a data because, it speaks of everything. For example with just a look we can say when a video was viewed the maximum or, thhe time time when most people commented on it. so for any data when plot with respect with time, this method can be used. And to get this representation a (very)basic idea of CSS is required.

  • A pie Chart can be used to show the number of likes and dislikes in a given time frame.

  • Although I have not yet read anything about obtaining the geographical location of users who viewed the video, but in case I get that information, then We can get an idea of the region where the video is more popular.

  • We can also get Demographics. Thus we can create a pie chart depicting the number of users in various age groups who have viewed the video.

The data generated by Youtube and its analytics is complete in itself. I want to utilize those data to create ideas(insights) as ratings out of 10.

These instincts are based on the rate of change of numbers. These changes can be recorded by periodically collecting data, say a cron job.

Virality: The API would be collecting data periodically. The intervals of these ratings can be managed by the user to get more accurate results. Then, based on the increase in the number of views and number of countries viewing it, we can generate the "virality" or how viral has the video been in the interval. So, if I give 8 to a video, then it would mean that if you have "x" number of views from "y" different countries in the interval of time "t", then the rating would v = function of (x,y,t), where v is referred to as virality.

Number of people talking about this: Based on virality and increase in the number of comments, we can generate the "Number of people talking about this". I beleive that if more people are commenting on the video, then they will also be talking about the video in their friend circle. The rating would mean similar to as defined in "virality" section above.

Feedback: Based on the difference between the increase of number of like/dislikes, We can generate the number of positive/negative feedback. We can also combine this data with the locations of people viewing the video to tell which region likes the video comparatively to other regions.

Age Groups: The above data will be combined with the different age group of viewers obtained from the api, to reflect more refined results. The user can make settings for the age group he wants to view from the settings page.

I would always prefer to depict data in the format http://goo.gl/XEGpF rather than using bar graphs, because they appeal more to me.

From the coding point of view, As it is also stated on the Google Developers page, these data can be obtained easily using the Zend Framework, where an authorization key has to be created by the user. But, in case I am not allowed to use Zend, I can use samples of code from Zend for Gdata, or write a SOAP code for the same. For both the cases, I can manage the data, and the above instincts can be obtained by simple mathematical calculations.

I would also prefer to show the direct results obtained from Youtube to the users in the above form of graph i.e. http://goo.gl/XEGpF .

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.