ITEC 4961/CSCI 4961 Web Science (Fall 2010)/Lab/Lab4

From Web Science 2009 class

Jump to: navigation, search

Contents

Download YouTube Python Library

http://gdata-python-client.googlecode.com/files/gdata-2.0.12.zip

  • unzip, cd into directory and run "python setup.py install"

Docs for Library

http://code.google.com/apis/youtube/1.0/developers_guide_python.html

  • developer key is AI39si7JxcEVDfPMZvcvw9rXyXNtSBhwzQiQTyTsGm4PTIU-TUDXkvy2fcpQpJggdYpW0zI4-u5QHs6_s8RHqYVV_ujUh8m-rg
  • application name is webscitest

Example

import gdata.youtube
import gdata.youtube.service
yt_service = gdata.youtube.service.YouTubeService()
yt_service.email = 'jo@gmail.com'
yt_service.password = 'mypassword'
yt_service.source = 'my-example-application'
yt_service.developer_key = 'ABC123...'
yt_service.client_id = 'my-example-application'
yt_service.ProgrammaticLogin()
feed = yt_service.GetYouTubeVideoFeed('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated')
for entry in feed.entry:
  print entry.media.title.text


Questions

Using the YouTube API, answer these questions. Please e-mail your answers, and your code to Dominic (difrad@cs.rpi.edu) with subject line (Web Sci Lab 4). Include the names and e-mail addresses of all members in your group.

Questions 1: What are the total views of all the videos from user schmoyoho (http://www.youtube.com/user/schmoyoho)

Question 2: Display top 20 video titles from the search "We No Speak Americano"

Question 3: For this video (http://www.youtube.com/watch?v=apKO7DUnkXo) display some of the comments and related videos.

Bonus Question: Make a tree of related videos starting with the one above. Go at least 5 levels deep and prune for duplicates. Which video came first?

Personal tools