I can parse the link with below codes but not working;
if url.find('mail.ru') > -1:
try:#http://api.video.mail.ru/videos/mail...s/180/279.json
url = 'http://api.video.'+url+'.json'
request = urllib2.Request(url, None, {'User-agent': 'Mozilla/5.0','Connection': 'Close'})
try:
data = urllib2.urlopen(request).read()
match=re.compile('"hd":"(http://video-cdn.*?)"[,|}]').findall(data)
url = match[0]
print url
except Exception, e:
print 'no link found : '+ str(e)
except:
pass
if url.find('mail.ru') > -1:
try:#http://api.video.mail.ru/videos/mail...s/180/279.json
url = 'http://api.video.'+url+'.json'
request = urllib2.Request(url, None, {'User-agent': 'Mozilla/5.0','Connection': 'Close'})
try:
data = urllib2.urlopen(request).read()
match=re.compile('"hd":"(http://video-cdn.*?)"[,|}]').findall(data)
url = match[0]
print url
except Exception, e:
print 'no link found : '+ str(e)
except:
pass
Комментарий