udpate youtube drm
This commit is contained in:
parent
49aba849c0
commit
0600d39198
1 changed files with 2 additions and 15 deletions
|
@ -11,23 +11,10 @@ from oxlib import findString, findRe
|
||||||
|
|
||||||
|
|
||||||
def getVideoKey(youtubeId):
|
def getVideoKey(youtubeId):
|
||||||
data = getUrl("http://www.youtube.com/watch?v=%s" % youtubeId)
|
data = getUrl("http://www.youtube.com/get_video_info?&video_id=%s" % youtubeId)
|
||||||
match = re.compile(".*[?&]t=([^&]+).*").findall(data)
|
match = re.compile("token=(.+)&thumbnail").findall(data)
|
||||||
if match:
|
if match:
|
||||||
return unquote(match[0])
|
return unquote(match[0])
|
||||||
try:
|
|
||||||
conn = httplib.HTTPConnection ("www.youtube.com")
|
|
||||||
conn.request ("HEAD", '/v/' + youtubeId)
|
|
||||||
response = conn.getresponse ()
|
|
||||||
conn.close ()
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if response.status >= 300 and response.status < 400:
|
|
||||||
location = response.getheader("location")
|
|
||||||
match = re.match(".*[?&]t=([^&]+)", location)
|
|
||||||
if match:
|
|
||||||
return unquote(match.groups()[0])
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getVideoUrl(youtubeId, format='mp4'):
|
def getVideoUrl(youtubeId, format='mp4'):
|
||||||
|
|
Loading…
Reference in a new issue