Extract a list of hyperlinks from an HTML document.

def extract_links(html):
        """
        Extract a list of hyperlinks from an HTML document.
        """
        links = []
        soup = BeautifulSoup(html, 'html.parser')
        for link in soup.findAll('a'):
            href = link.get('href')
            if not href:
                continue
            if href.startswith('/'):
                href = 'https://www.reddit.com' + href
            links.append({'text': link.text, 'href': href})
        return links