Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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")
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
def _get(url):
    # only scrape within the site
    return common.webread(url)