Skip to content

Commit

Permalink
update playVideo() function
Browse files Browse the repository at this point in the history
  • Loading branch information
monarc99 committed Jun 4, 2015
1 parent dee7018 commit 63f52e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions default.py
Expand Up @@ -55,10 +55,18 @@ def listVideos(url):
xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')


def getRedirectedUrl(url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0')
response = urllib2.urlopen(req)
response.close()
return str(response.geturl())


def playVideo(url):
content = opener.open(url).read()
match = re.compile('"url":"(.+?)"', re.DOTALL).findall(content)
finalURL = match[0].replace("https","http")
match = re.compile('"dataUrl":"(.+?)"', re.DOTALL).findall(content)
finalURL = getRedirectedUrl(match[0])
listitem = xbmcgui.ListItem(path=finalURL)
xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)

Expand Down

0 comments on commit 63f52e5

Please sign in to comment.