コード例 #1
0
ファイル: scrapers.py プロジェクト: vanhung1710/MyRepository
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)
コード例 #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")
コード例 #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)
コード例 #4
0
ファイル: scrapers.py プロジェクト: vphuc81/MyRepository
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)
コード例 #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)
コード例 #6
0
def _get(url):
    # only scrape within the site
    return common.webread(url)