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)
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])
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])