Page 1 of 1

Implementing Youtube "Most Popular" list

Posted: Sun Aug 02, 2009 6:28 pm
by bsharp42
Hello,

I am new to web development so this may seem like a very simple concept but I hope you won't criticize me too much here. =p


I am building a website right now and I wanted to implement something like the "Most Popular" list implemented in youtube.com main home page.

This is what I was thinking of.

Lets say I have 4 categories : category1, category2, category3, category4.

When a user browses through my site and clicks on a "thing" in a category, I will add that to MySQL database. If the clicked "thing" is new, create a new row for it with a "count" field, if the clicked "thing" already exists in the table, 1++ to the count.

(each "thing" will have a specific category)

When the user clicks on the homepage, retrieve the "thing" with the most number of counts for each category; then display those "things" onto the webpage.

Does this sound okay so far?? Is this a reasonable way to implement a "most popular list" ??

Also, I'm not sure how to implement the freshness of this list. I want the most popular list to reset/refresh each day or each week so that the list isn't dominated by the same "thing" each week. How would I go on to implement this ?

Any advice on anything is very much appreciated. I am new, and I am willing to learn. I just want to make sure this is the correct way of implementing such feature so that I don't have to go on and implement this the wrong way and go *facepalm* 3 months innto it.

Re: Implementing Youtube "Most Popular" list

Posted: Sun Aug 02, 2009 7:14 pm
by Eran
Also, I'm not sure how to implement the freshness of this list. I want the most popular list to reset/refresh each day or each week so that the list isn't dominated by the same "thing" each week. How would I go on to implement this ?
If you want to keep track of score by time, you'll have to dedicated a row per page view. Then select by a date range (for example, between a week ago and today) and count the number of rows for that time period.

Re: Implementing Youtube "Most Popular" list

Posted: Mon Aug 03, 2009 12:48 pm
by John Cartwright
I tend to dedicate 1 row per time interval, be it 1 day or 1 hour. This saves tremendously on high traffic sites, however, it slightly less flexible.