def get_media_url(self, web_url):
#grab stream address
try:
html = self.net.http_GET(web_url).content
except urllib2.URLError, e:
common.addon.log_error('videoweed: got http error %d fetching %s' %
(e.code, web_url))
return False
r = re.search('flashvars.domain="(.+?)";.*flashvars.file="([a-zA-Z0-9]+)";.*flashvars.filekey="(.+?)";.+?flashvars', html, re.DOTALL)
if r:
domain = r.group(1)
fileid = r.group(2)
filekey = r.group(3)
api_call = domain + '/api/player.api.php?user=undefined&codes=1&file=' + fileid + '&pass=undefined&key=' + filekey
else:
common.addon.log_error('videoweed: api url not found')
return False
try:
apihtml = self.net.http_GET(api_call).content
except urllib2.URLERROR, e:
common.addon.log_error('videoweed: failed to call the video API got http error %d fetching %s' %
(e.code, api_call))
return False
rapi = re.search('url=(.+?)&title=',apihtml)
if rapi:
stream_url = rapi.group(1)
else:
common.addon.log_error('videoweed: stream url not found')
return stream_url