Пример #1
0
def from_any(html_or_string, **kw):
    """
    Parse urls out of html or raw string.
    """
    if not html_or_string:
        return []
    if html.is_html(html_or_string):
        return from_html(html_or_string, **kw)
    return from_string(html_or_string, **kw)
Пример #2
0
def from_any(html_or_string, **kw):
    """
    Parse urls out of html or raw string.
    """
    if not html_or_string:
        return []
    if html.is_html(html_or_string):
        return from_html(html_or_string, **kw)
    return from_string(html_or_string, **kw)
Пример #3
0
def _prepare_str(o, field, source_url=None):
    """
    Prepare text/html field
    """
    if field not in o:
        return None
    if o[field] is None:
        return None
    if html.is_html(o[field]):
        return html.prepare(o[field], source_url)
    return text.prepare(o[field])
Пример #4
0
def prepare_str(o, field, source_url=None):
    """
    Prepare text/html field
    """
    if field not in o:
        return None
    if o[field] is None:
        return None
    if html.is_html(o[field]):
        return html.prepare(o[field], source_url)
    return text.prepare(o[field])