

def linklist(url):
    'Return a JSON list of all on-domain links on the page.'
    apexdom = apex(url)
    import lxml.html
    ro = requests.get(url, timeout=5)
    doc = lxml.html.fromstring(ro.text)
    doc.make_links_absolute(url)
    somelinks = doc.xpath('/html/body//a/@href')
    plinks = set()
    for alink in somelinks:
        if (urlparse.urlparse(alink)[1][(- len(apexdom)):] == apexdom):
            plinks.add(alink)
    plinks = list(plinks)
    return plinks

dataset/ETHPy150Open miklevin/pipulate/common.py linklist/original