def _get(url): # only scrape within the site if any(domain in url for domain in config.domains): # good enough check # should not be larger than 1MB return common.webread(url) else: raise Exception('Bad URL: %s' % url)
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 _get(url): # only scrape within the site if url.startswith(config.base_url): # good enough check # should not be larger than 1MB return common.webread(url) else: raise Exception('Bad URL: %s' % url)
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)
def _get(url): # only scrape within the site return common.webread(url)