コード例 #1
0
ファイル: url.py プロジェクト: jjelosua/newslynx-core
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
ファイル: url.py プロジェクト: jjelosua/newslynx-core
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
ファイル: ingest.py プロジェクト: abelsonlive/newslynx-core
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
ファイル: ingest_util.py プロジェクト: jjelosua/newslynx-core
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])