def extractFromURL(url,
    cache=False,
    cacheDir='_cache',
    verbose=False,
    encoding=None,
    filters=None,
    userAgent=None,
    timeout=5,
    blur=5,
    ignore_robotstxt=False,
    only_mime_types=None,
    raw=False):
    """
    Extracts text from a URL.

    Parameters:
    url := string
        Remote URL or local filename where HTML will be read.
    cache := bool
        True=store and retrieve url from cache
        False=always retrieve url from the web
    cacheDir := str
        Directory where cached url contents will be stored.
    verbose := bool
        True=print logging messages
        False=print no output
    encoding := string
        The encoding of the page contents.
        If none given, it will attempt to guess the encoding.
        See http://docs.python.org/howto/unicode.html for further info
        on Python Unicode and encoding support.
    filters := string
        Comma-delimited list of filters to apply before parsing.
    only_mime_types := list of strings
        A list of mime-types to limit parsing to.
        If the mime-type of the raw-content retrieved does not match
        one of these, a value of None will be returned.
    """

    blur = int(blur)

    try:
        import chardet
    except ImportError as e:
        raise ImportError(("%s\nYou need to install chardet.\n" + \
             "e.g. sudo pip install chardet") % e)

    if only_mime_types and isinstance(only_mime_types, six.text_type):
        only_mime_types = only_mime_types.split(',')

    # Load url from cache if enabled.
    if cache:
        if not os.path.isdir(cacheDir):
            cache_perms = 488 # 750 in octal, '-rwxr-x---'
            os.makedirs(cacheDir, cache_perms)

        cache_key = generate_key(url)
        cached_content = cache_get(cacheDir, cache_key)
        if cached_content:
            return cached_content

    if not ignore_robotstxt:
        if not check_robotstxt(url, cache, cacheDir, userAgent=userAgent):
            if verbose: print("Request denied by robots.txt")
            return ''

    # Otherwise download the url.
    if verbose: print('Reading %s...' % url)
    html = fetch(
        url,
        timeout=timeout,
        userAgent=userAgent,
        only_mime_types=only_mime_types)
    if not html:
        return ''

    # If no encoding guess given, then attempt to determine
    # encoding automatically.
    if not encoding:
        if isinstance(html, unicode):
            html = html.encode('utf8', 'replace')
        encoding_opinion = chardet.detect(html)
        encoding = encoding_opinion['encoding']
        if verbose: print('Using encoding %s.' % encoding)

    # Save raw contents to cache if enabled.
    if verbose: print('Read %i characters.' % len(html))
    if cache:
        raw_key = generate_key(url, "%s.raw")
        cache_set(cacheDir, raw_key, html)

    # Apply filters.
    if filters:
        filter_names = map(str.strip, filters.split(','))
        for filter_name in filter_names:
            fltr = get_filter(filter_name)
            html = fltr(html)

    # Clean up HTML.
    html = tidyHTML(html)
    if verbose: print('Extracted %i characters.' % len(html))

    # Convert to Unicode.
    if not html:
        return ''
    html = unicode(html, encoding=encoding, errors='replace')
    if raw:
        return html

    # Extract text from HTML.
    res = extractFromHTML(html, blur=blur)
    assert isinstance(res, unicode)

    # Save extracted text to cache if enabled.
    res = res.encode(encoding, 'ignore')
    if cache:
        cache_set(cacheDir, cache_key, res)

    return res
Extracts text from a URL.

    Parameters:
    url := string
        Remote URL or local filename where HTML will be read.
    cache := bool
        True=store and retrieve url from cache
        False=always retrieve url from the web
    cacheDir := str
        Directory where cached url contents will be stored.
    verbose := bool
        True=print logging messages
        False=print no output
    encoding := string
        The encoding of the page contents.
        If none given, it will attempt to guess the encoding.
        See http://docs.python.org/howto/unicode.html for further info
        on Python Unicode and encoding support.
    filters := string
        Comma-delimited list of filters to apply before parsing.
    only_mime_types := list of strings
        A list of mime-types to limit parsing to.
        If the mime-type of the raw-content retrieved does not match
        one of these, a value of None will be returned.