mf2util.py
def parse_author(obj):
    """Parse the value of a u-author property, can either be a compound
    h-card or a single name or url.

    :param object obj: the mf2 property value, either a dict or a string
    :result: a dict containing the author's name, photo, and url
    """
    result = {}
    if isinstance(obj, dict):
        names = obj['properties'].get('name')
        photos = obj['properties'].get('photo')
        urls = obj['properties'].get('url')
        if names:
            result['name'] = names[0]
        if photos:
            result['photo'] = photos[0]
        if urls:
            result['url'] = urls[0]
    elif obj:
        if obj.startswith('http://') or obj.startswith('https://'):
            result['url'] = obj
        else:
            result['name'] = obj
    return result
Parse the value of a u-author property, can either be a compound
    h-card or a single name or url.

    :param object obj: the mf2 property value, either a dict or a string
    :result: a dict containing the author's name, photo, and url
    
Parse the value of a u-author property, can either be a compound
h-card or a single name or url.
Parse the value of a u - author property can either be a compound h - card or a single name or url .
def parse_author(obj):
    result = {}
    if isinstance(obj, dict):
        names = obj['properties'].get('name')
        photos = obj['properties'].get('photo')
        urls = obj['properties'].get('url')
        if names:
            result['name'] = names[0]
        if photos:
            result['photo'] = photos[0]
        if urls:
            result['url'] = urls[0]
    elif obj:
        if obj.startswith('http://') or obj.startswith('https://'):
            result['url'] = obj
        else:
            result['name'] = obj
    return result
def parse_author ( obj ) : result = { } if isinstance ( obj , dict ) : names = obj [ 'properties' ] . get ( 'name' ) photos = obj [ 'properties' ] . get ( 'photo' ) urls = obj [ 'properties' ] . get ( 'url' ) if names : result [ 'name' ] = names [ 0 ] if photos : result [ 'photo' ] = photos [ 0 ] if urls : result [ 'url' ] = urls [ 0 ] elif obj : if obj . startswith ( 'http://' ) or obj . startswith ( 'https://' ) : result [ 'url' ] = obj else : result [ 'name' ] = obj return result
Parse the value of a u-author property, can either be a compound
h-card or a single name or url.
Parse the value of a u - author property can either be a compound h - card or a single name or url .
"""Parse the value of a u-author property, can either be a compound
    h-card or a single name or url.

    :param object obj: the mf2 property value, either a dict or a string
    :result: a dict containing the author's name, photo, and url
    """
obj
the mf2 property value, either a dict or a string
the mf2 property value either a dict or a string
result
a dict containing the author's name, photo, and url
a dict containing the author ' s name photo and url