@main.route('/api/authorship')
def get_post_author():
    page_to_check = request.args.get('url')
    mf2_parsed = mf2py.parse(page_to_check)
    if (not mf2_parsed):
        return jsonify({'status': 'failed', 'message': 'No microformats could be found on this page', 'author': []})
    if (not mf2_parsed['items']):
        return jsonify({'status': 'failed', 'message': 'No microformats could be found on this page', 'author': []})
    h_entry = [i for i in mf2_parsed['items'] if (i['type'] == ['h-entry'])]
    h_card = [i for i in mf2_parsed['items'] if (i['type'] == ['h-card'])]
    if ((not h_entry) and (h_card == [])):
        return jsonify({'status': 'failed', 'message': 'No h-entry could be found on this page', 'author': []})
    if (h_card == []):
        for i in h_entry['items']:
            if (i['type'] == ['h-entry']):
                if i['properties'].get('author'):
                    if ((type(i['properties']['author'][0]) == dict) and (i['properties']['author'][0].get('type') == ['h-card'])):
                        h_card = i['properties']['author'][0]
                    elif (type(i['properties']['author']) == list):
                        h_card = i['properties']['author'][0]
    result = indieweb_utils.discover_author(h_card, h_entry, page_to_check, [])
    return jsonify({'status': 'success', 'result': result})
@main.route('/api/authorship')
def get_post_author():
    page_to_check = request.args.get('url')
    mf2_parsed = mf2py.parse(page_to_check)
    if (not mf2_parsed):
        return jsonify({'status': 'failed', 'message': 'No microformats could be found on this page', 'author': []})
    if (not mf2_parsed['items']):
        return jsonify({'status': 'failed', 'message': 'No microformats could be found on this page', 'author': []})
    h_entry = [i for i in mf2_parsed['items'] if (i['type'] == ['h-entry'])]
    h_card = [i for i in mf2_parsed['items'] if (i['type'] == ['h-card'])]
    if ((not h_entry) and (h_card == [])):
        return jsonify({'status': 'failed', 'message': 'No h-entry could be found on this page', 'author': []})
    if (h_card == []):
        for i in h_entry['items']:
            if (i['type'] == ['h-entry']):
                if i['properties'].get('author'):
                    if ((type(i['properties']['author'][0]) == dict) and (i['properties']['author'][0].get('type') == ['h-card'])):
                        h_card = i['properties']['author'][0]
                    elif (type(i['properties']['author']) == list):
                        h_card = i['properties']['author'][0]
    result = indieweb_utils.discover_author(h_card, h_entry, page_to_check, [])
    return jsonify({'status': 'success', 'result': result})