def play_video( name, url, thumb, plot, studio, starttime, backup_url ): if url == 'None': dialog = xbmcgui.Dialog() ok = dialog.ok( plugin , settings.getLocalizedString( 30008 ) ) return if url.find('http://urs.pbs.org/redirect/') != -1: try: import requests status = 0 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0'} while status <= 10: if status != 0: time.sleep(3) r = requests.head(url , headers=headers, allow_redirects=False) new_url = r.headers['location'] if new_url != None: break status += 1 infoLabels = { "Title": name , "Studio": "PBS: " + studio, "Plot": plot } playListItem(label = name, image = thumb, path = clean(new_url), infoLabels = infoLabels, PlayPath = False) return except Exception, e: print 'PBS - Using backup_url' if backup_url != 'None': infoLabels = { "Title": name , "Studio": "PBS: " + studio, "Plot": plot } playListItem(label = name, image = thumb, path = clean(backup_url), infoLabels = infoLabels, PlayPath = False) return else: dialog = xbmcgui.Dialog() ok = dialog.ok( plugin , settings.getLocalizedString( 30008 ) ) ok = dialog.ok(plugin, settings.getLocalizedString( 30051 )) buggalo.addExtraData('url', url) buggalo.addExtraData('error', str(e)) buggalo.addExtraData('info', studio + ' - ' + name) raise Exception("redirect_url ERROR") return
def play_video(name, url, thumb, plot): url = "http://www.nba.com/video/" + url + ".xml" html = getPage(url) if html["error"] == "HTTP Error 404: Not Found": dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString(30006)) return url = "http://nba.cdn.turner.com/nba/big" + common.parseDOM(html["content"], "file", attrs={"type": "large"})[0] infoLabels = {"Title": name, "Studio": plugin, "Plot": plot} playListItem(label=name, image=thumb, path=url, infoLabels=infoLabels, PlayPath=False)
def play_video(url, name, thumb, plot): infoLabels = { "Title": name, "Studio": plugin, "Plot": plot } result = getPage("http://vod.espn.go.com/motion/" + url + ".smil?FLVPlaybackVersion=2.1") if '404' in str(result["error"]): dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString( 30004 )) return else: playpath = "mp4:" + url + "_" + settings.getSetting("quality") + ".mp4" url = 'rtmp://svod.espn.go.com/motion/' playListItem(label = name, image = thumb, path = url, infoLabels = infoLabels, PlayPath = playpath)
def play_video( name, url, thumb, studio ): if studio != settings.getLocalizedString( 30007 ): try: data = getUrl( url, True ) url = re.compile('<media url=\"(.+?)\"').findall(data)[0] except: url = 'http://www.tmz.com/videos/' + thumb.split('/')[9] data = getUrl( url, True ) url = common.parseDOM(data, "meta", attrs = { "name": "VideoURL" }, ret = "content")[0] infoLabels = { "Title": name , "Studio": "TMZ: " + studio, "Plot": name } playListItem(label = name, image = thumb, path = url, infoLabels = infoLabels)
def play_video(name, url, plot, thumb): videokey = re.compile("videos/(.+?)/(.+?)/").findall(url) url = ( "http://g4tv.com/xml/broadbandplayerservice.asmx/GetEmbeddedHdVideo?videoKey=" + videokey[0][0] + "&playLargeVideo=true&excludedVideoKeys=&playlistType=normal&maxPlaylistSize=0" ) data = getUrl(url) url = clean(re.compile("&r=(.+?)</FilePath>").findall(data)[0]) infoLabels = {"Title": name, "Studio": plugin, "Plot": plot} playListItem(label=name, image=thumb, path=url, infoLabels=infoLabels)
def get_video(url, name, plot, studio, episode, thumb, date): if '{' in url: url = ast.literal_eval(url) try: path = url[settings.getSetting('format').lower().replace('hd','hd720p30').replace('high','large').replace('low','small')]['url'] except: if 'hd' in url: path = url['hd']['url'] elif 'large' in url: path = url['large']['url'] elif 'small' in url: path = url['small']['url'] else: path = url.items()[0][1]['url'] else: oembed = getUrl('http://revision3.com/api/oembed/?url=http://revision3.com/%s/&format=json' % url) video_id = re.compile('html5player\-v(.+?)\?external').findall(oembed)[0] api = getUrl('http://revision3.com/api/flash?video_id=' + video_id) videos_api = common.parseDOM(api, "media", ret = "type") videos_api[:] = (value for value in videos_api if value != 'thumbnail') durl = {} for type_api in videos_api: content_api = clean(common.parseDOM(api, "media", attrs = { "type": type_api })[0]) durl[type_api] = content_api try: path = durl[settings.getSetting('format').lower()] except: if 'high' in durl: path = durl['high'] elif 'low' in durl: path = durl['low'] else: path = str(durl.items()[0][1]) if settings.getSetting('download') == 'true': while not settings.getSetting('downloadPath'): if settings.getSetting('download') == 'false': xbmc.executebuiltin("Container.Refresh") return dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString( 30011 )) settings.openSettings() params = { "url": path, "download_path": settings.getSetting('downloadPath'), "Title": name } downloader.download(clean_file(name) + '.' + path.split('/')[-1].split('.')[-1], params) else: infoLabels = { "Title": name, "Studio": 'Revision3: ' + studio, "Plot": plot, "Episode": int(episode), "Aired": date } playListItem(label = name, image = thumb, path = path, infoLabels = infoLabels, PlayPath = False)
def play_video(url, name, download): data = getUrl(url) title = re.search('<meta itemprop="name" content="(.+?)">', data) thumb = re.search('<meta itemprop="thumbnailUrl" content="(.+?)">', data) trailerId = re.search( '<meta itemprop="embedUrl" content=".+traileraddict\.com/emd/(.+?)\?id=.+?">', data) if trailerId: data = getUrl('http://v.traileraddict.com/%s' % trailerId.group(1)) data = unwise.unwise_process(data) video_urls = re.compile("file:[\\\]*'(.+?)'").findall(data) else: return if title: name = urllib.unquote_plus( title.group(1)) + ' (' + settings.getLocalizedString(30017) + ')' if thumb: if thumb.group( 1 ) == 'http://www.traileraddict.com/images/noembed-removed.png': dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString(30012)) return if settings.getSetting('streamQuality') == '1': url = video_urls[1] else: url = video_urls[0] url = url.replace('%3A', ':').replace('%2F', '/').replace('%3F', '?').replace( '%3D', '=').replace('%26', '&').replace('%2F', '//').strip() infoLabels = {"Title": name, "Studio": plugin} if download == 'True': start_download(name, str(url)) else: playListItem(label=name, image=xbmc.getInfoImage("ListItem.Thumb"), path=str(url), infoLabels=infoLabels, PlayPath=False)
def play_video(url, name, thumb, plot): infoLabels = { "Title": name, "Studio": plugin, "Plot": plot } result = getPage("http://vod.espn.go.com/motion/" + url + ".smil?FLVPlaybackVersion=2.1") if '404' in str(result["error"]): dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString( 30004 )) return else: playpath = "mp4:" + url + "_" + settings.getSetting("quality") + ".mp4" # Address a bug in early helix versions: try: version = xbmc_version = xbmc.getInfoLabel( "System.BuildVersion" ) version = float(version[:4]) if version >= 14.0 and version < 14.2: url = 'rtmp://svod.espn.go.com/motion/' + url + "_" + settings.getSetting("quality") + ".mp4" else: url = 'rtmp://svod.espn.go.com/motion/' except: url = 'rtmp://svod.espn.go.com/motion/' playListItem(label = name, image = thumb, path = url, infoLabels = infoLabels, PlayPath = playpath)
def play_video( url, name, download ): data = getUrl( url ) url = re.compile( '<param name="movie" value="http://www.traileraddict.com/emb/(.+?)">' ).findall( data )[0] if data.find( 'watchplus()' ) > 0: url = 'http://www.traileraddict.com/fvarhd.php?tid=' + url else: url = 'http://www.traileraddict.com/fvar.php?tid=' + url data = getUrl( url ) thumb = re.compile( '&image=(.+?)&' ).findall( data )[0] title = re.compile( '&filmtitle=(.+?)&' ).findall( data ) if len(title): name = urllib.unquote_plus(title[0]) + ' (' + settings.getLocalizedString(30017) + ')' if thumb == 'http://www.traileraddict.com/images/noembed-removed.png': dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString( 30012 )) return url = re.compile( 'fileurl=(.+?)\n&vidwidth', re.DOTALL ).findall( data )[0] url = url.replace( '%3A', ':').replace( '%2F', '/' ).replace( '%3F', '?' ).replace( '%3D', '=' ).replace( '%26', '&' ).replace( '%2F', '//' ) infoLabels = { "Title": name , "Studio": plugin } if download == 'True': start_download(name, str(url)) else: playListItem(label = name, image = xbmc.getInfoImage( "ListItem.Thumb" ), path = str(url), infoLabels = infoLabels, PlayPath = False)
ok = dialog.ok( plugin , settings.getLocalizedString( 30008 ) ) return if msg == 'Unavailable': dialog = xbmcgui.Dialog() ok = dialog.ok( plugin , settings.getLocalizedString( 30015 ) + '\n' + settings.getLocalizedString( 30016 ) ) return except: print 'PBS - Failed to check video status' pass try: base = re.compile( '<meta base="(.+?)" />' ).findall( data )[0] except: print 'PBS - Using backup_url' if backup_url != 'None': infoLabels = { "Title": name , "Studio": "PBS: " + studio, "Plot": plot } playListItem(label = name, image = thumb, path = clean(backup_url), infoLabels = infoLabels, PlayPath = False) return else: dialog = xbmcgui.Dialog() ok = dialog.ok( plugin , settings.getLocalizedString( 30008 ) ) ok = dialog.ok(plugin, settings.getLocalizedString( 30051 )) buggalo.addExtraData('url', url) buggalo.addExtraData('info', studio + ' - ' + name) raise Exception("backup_url ERROR") return src = re.compile( '<ref src="(.+?)" title="(.+?)" (author)?' ).findall( data )[0][0] # if src.find('m3u8') != -1: # dialog = xbmcgui.Dialog() # ok = dialog.ok( plugin , settings.getLocalizedString( 30008 ) ) # return playpath = None
url = 'None' backup_url = 'None' redirect = False #Fails if url == 'None' and backup_url == 'None': dialog = xbmcgui.Dialog() ok = dialog.ok(plugin , settings.getLocalizedString( 30008 )) ok = dialog.ok(plugin, settings.getLocalizedString( 30051 )) buggalo.addExtraData('defaulturl', defaulturl) buggalo.addExtraData('url', url) buggalo.addExtraData('info', studio + ' - ' + name) raise Exception("backup_url ERROR") infoLabels = { "Title": name , "Studio": "PBS: " + studio, "Plot": plot } playListItem(label = name, image = thumb, path = url, infoLabels = infoLabels, PlayPath = playpath) params = getParameters(sys.argv[2]) starttime = None mode = None name = None url = None thumb = None plot = None studio = None program_id = None backup_url = None topic = None page = 0 try:
def get_video(url, name, plot, studio, episode, thumb, date): if '{' in url: url = ast.literal_eval(url) try: path = url[settings.getSetting('format').lower().replace( 'hd', 'hd720p30').replace('high', 'large').replace('low', 'small')]['url'] except: if 'hd' in url: path = url['hd']['url'] elif 'large' in url: path = url['large']['url'] elif 'small' in url: path = url['small']['url'] else: path = url.items()[0][1]['url'] else: oembed = getUrl( 'http://testtube.com/api/oembed/?url=http://testtube.com/%s/&format=json' % url) video_id = re.compile('html5player\-v(.+?)\?external').findall( oembed)[0] api = getUrl('http://testtube.com/api/flash?video_id=' + video_id) videos_api = common.parseDOM(api, "media", ret="type") videos_api[:] = (value for value in videos_api if value != 'thumbnail') durl = {} for type_api in videos_api: content_api = clean( common.parseDOM(api, "media", attrs={"type": type_api})[0]) durl[type_api] = content_api try: path = durl[settings.getSetting('format').lower()] except: if 'high' in durl: path = durl['high'] elif 'low' in durl: path = durl['low'] else: path = str(durl.items()[0][1]) if settings.getSetting('download') == 'true': while not settings.getSetting('downloadPath'): if settings.getSetting('download') == 'false': xbmc.executebuiltin("Container.Refresh") return dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString(30011)) settings.openSettings() params = { "url": path, "download_path": settings.getSetting('downloadPath'), "Title": name } downloader.download( clean_file(name) + '.' + path.split('/')[-1].split('.')[-1], params) else: infoLabels = { "Title": name, "Studio": 'TestTube: ' + studio, "Plot": plot, "Episode": int(episode), "Aired": date } playListItem(label=name, image=thumb, path=path, infoLabels=infoLabels, PlayPath=False)
def get_video(url, name, plot, studio, episode, thumb, date): result = getUrl(url) video_id = re.compile('player\.loadRevision3Item\(\'video_id\',(.+?)\);').findall(result)[0].replace(' ','') api = getUrl('http://revision3.com/api/flash?video_id=' + video_id) videos_api = common.parseDOM(api, "media", ret = "type") videos_api[:] = (value for value in videos_api if value != 'thumbnail') durl = {} for type_api in videos_api: content_api = clean(common.parseDOM(api, "media", attrs = { "type": type_api })[0]) durl[type_api] = content_api list = ['MP4','Quicktime','Xvid','WMV','Unknown File Type'] for type in list: content = common.parseDOM(result, "div", attrs = { "id": "action-panels-download-" + type }) videos = common.parseDOM(content, "a", attrs = { "class": "sizename" }) links = common.parseDOM(content, "a", attrs = { "class": "sizename" }, ret="href") count = 0 for add in videos: if type == 'Unknown File Type': code = type else: code = type + ':' + add durl[code] = links[count] count += 1 dictList = [] for key, value in durl.iteritems(): dictList.append(key) quality = settings.getSetting('type') try: try: purl = durl[quality] except: if quality == 'MP4:HD': if 'Quicktime:HD' in durl: quality_api = 'Quicktime:HD' else: quality_api = 'hd' if quality == 'MP4:Large': if 'Quicktime:Large' in durl: quality_api = 'Quicktime:Large' else: quality_api = 'high' if quality == 'MP4:Phone': quality_api = 'low' purl = durl[quality_api] ret = None except: dialog = xbmcgui.Dialog() ret = dialog.select(settings.getLocalizedString( 30017 ), dictList) purl = durl[dictList[ret]] if ret != -1: if settings.getSetting('download') == 'true': while not settings.getSetting('downloadPath'): if settings.getSetting('download') == 'false': xbmc.executebuiltin("Container.Refresh") return dialog = xbmcgui.Dialog() ok = dialog.ok(plugin, settings.getLocalizedString( 30011 )) settings.openSettings() params = { "url": purl, "download_path": settings.getSetting('downloadPath'), "Title": name } downloader.download(clean_file(name) + '.' + purl.split('/')[-1].split('.')[-1], params) else: infoLabels = { "Title": name, "Studio": 'Revision3: ' + studio, "Plot": plot, "Episode": int(episode), "Aired": date } playListItem(label = name, image = thumb, path = purl, infoLabels = infoLabels, PlayPath = False)