def webread(url): url = url.encode('utf8') url = quote(url, ':/') net = Net() headers = {'User-Agent': get_ua()} return net.http_GET(url, headers=headers).content
def play_mirror(url): with common.busy_indicator(): # soup = BeautifulSoup(common.webread(url), 'html5lib') # iframe = soup.find(id='iframeplayer') # iframe_url = urljoin(config.base_url, iframe.attrs['src']) (vidurl, pars) = scrapers.episodeVideo(urljoin(config.video_url, url)) # common.resolve(url) vidurl = _base64(vidurl) if not re.match(r'(.)*\.m3u8$', vidurl): if re.match(r'(.*)123ku(.*)', pars): vidurl = scrapers.episodeVideo_123ku(vidurl) else: vidurl = scrapers.episodeVideo_dplayer(vidurl) if vidurl: try: title, image = scrapers.title_image( urljoin(config.video_url, url)) except Exception: # we can proceed without the title and image title, image = ('', '') li = xbmcgui.ListItem(title) if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + quote(get_ua()) xbmc.Player().play(vidurl, li)
def play_mirror(url): with common.busy_indicator(): soup = BeautifulSoup(common.webread(url), 'html5lib') iframe = soup.find(id='iframeplayer') iframe_url = urljoin(config.base_url, str(iframe.attrs['src'])) try: vidurl = common.resolve(iframe_url) except ResolverError as e: if str(e) == 'No link selected': return raise e if vidurl: try: title, image = scrapers.title_image(url) except Exception: # we can proceed without the title and image title, image = ('', '') li = xbmcgui.ListItem(title) li.setArt({'thumb': image}) if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + urllib.parse.quote(get_ua()) xbmc.Player().play(vidurl, li) else: common.notify(heading="icDrama", message="Unable to play video")
def play_mirror(url): with common.busy_indicator(): # soup = BeautifulSoup(common.webread(url), 'html5lib') # iframe = soup.find(id='iframeplayer') # iframe_url = urljoin(config.base_url, iframe.attrs['src']) vidurl = scrapers.episodeVideo(urljoin(config.video_url, url)) # common.resolve(url) if vidurl: try: title, image = scrapers.title_image(urljoin(config.video_url, url)) except Exception: # we can proceed without the title and image title, image = ('', '') osWin = xbmc.getCondVisibility('system.platform.windows') osOsx = xbmc.getCondVisibility('system.platform.osx') osLinux = xbmc.getCondVisibility('system.platform.linux') osAndroid = xbmc.getCondVisibility('System.Platform.Android') li = xbmcgui.ListItem(title) li.setThumbnailImage(image) if osOsx or osWin or (osLinux and not osAndroid): if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua()) xbmc.Player().play(vidurl, li) elif osAndroid: xbmc.executebuiltin("PlayMedia("+vidurl+")")
def play_mirror(url): with common.busy_indicator(): common.error("What is the url: " + url) (title, vidurl) = scrapers.episodeVideo(url.split('?')[0]) # common.resolve(url) if vidurl: li = xbmcgui.ListItem(title) li.setThumbnailImage('') if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua()) xbmc.Player().play(vidurl, li)
def play_mirror(url): playing = False player = None orig_url = '' with common.busy_indicator(): vidurl = common.resolve(url) orig_url = vidurl if vidurl: try: title, image = scrapers.title_image(url) except Exception: # we can proceed without the title and image title, image = ('', '') li = xbmcgui.ListItem(title) li.setArt({ 'thumb' : image }) if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua()) # Instantiate own player class player = MyPlayer() player.play(vidurl, li) playing = True if player: counter = 0 # Checks for a minimum of 60 seconds; keeps script alive for this time while player.alive and counter < 30: counter += 1 xbmc.sleep(2000) if not player.hasStarted: common.debug('Icdrama: Player encountered a format that prevented it from starting') # Add to blacklist sourceutil.add_blacklist(orig_url) # Delete to free up reference del player # Try again play_mirror(url) else: # Delete to free up reference del player return playing
def play_mirror(url): with common.busy_indicator(): vidurl = common.resolve(url) if vidurl: try: title, image = scrapers.title_image(url) except Exception: # we can proceed without the title and image title, image = ('', '') li = xbmcgui.ListItem(title) li.setThumbnailImage(image) if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua()) xbmc.Player().play(vidurl, li)
def play_mirror(url): with common.busy_indicator(): common.error("What is the url: " + url) (title, vidurl) = scrapers.episodeVideo( url.split('?')[0]) # common.resolve(url) if vidurl: li = xbmcgui.ListItem(title) for pxyDomain in config.domain_using_proxy: if (re.search(pxyDomain, vidurl)): vidurl = config.local_proxy + '/' + re.sub( '\://', '/', vidurl, 1) break if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + quote(get_ua()) xbmc.Player().play(vidurl, li)
def play_mirror(url): with common.busy_indicator(): soup = BeautifulSoup(common.webread(url), 'html5lib') iframe = soup.find(id='iframeplayer') iframe_url = urljoin(config.base_url, iframe.attrs['src']) vidurl = common.resolve(iframe_url) if vidurl: try: title, image = scrapers.title_image(url) except Exception: # we can proceed without the title and image title, image = ('', '') li = xbmcgui.ListItem(title) li.setArt({ 'thumb': image }) if 'User-Agent=' not in vidurl: vidurl = vidurl + '|User-Agent=' + quote(get_ua()) xbmc.Player().play(vidurl, li)