youtube
This commit is contained in:
parent
b2c51e03b2
commit
917cbcf399
1 changed files with 4 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue