This commit is contained in:
j 2007-06-09 11:25:33 +00:00
parent b2c51e03b2
commit 917cbcf399

View file

@ -6,13 +6,15 @@ import re
import urllib2
from urllib import quote
from utils import read_url, open_url,
from utils import read_url, open_url
def get_video_url(id, get_redirected = False):
url = 'http://www.youtube.com/watch?v=%s' % id
data = read_url(url)
video = re.compile('player2.swf\?.*video_id=(.*?)\&').findall(data)
video = re.compile('player2.swf\?video_id=.*?&t=(.*?)"').findall(data)
if not video:
video = re.compile('player2.swf\?.*&t=(.*?)\&').findall(data)
if video:
url = "http://youtube.com/get_video.php?video_id=%s&t=%s"%(id, video[0])
if get_redirected: