def extract_canonical(bs4):
    """Extracting canonical url

    :param bs4:
    :return:
    """
    link_rel = bs4.select('link[rel="canonical"]')
    if link_rel.__len__() > 0:
        if link_rel[0].has_attr('href'):
            return link_rel[0]['href']
    return None
