def setolinks(url):
  '''Return a list of links from a given url'''
  import lxml.html
  apexdom = apex(url)
  ro = requests.get(url, timeout=5, verify=False)
  if ro.status_code == 200:
    doc = lxml.html.fromstring(ro.text)
    doc.make_links_absolute(url)
    somelinks = doc.xpath('/html/body//a/@href')
    links = set()
    for alink in somelinks:
      if urlparse.urlparse(alink)[1][-len(apexdom):] == apexdom:
        if alink != url:
          links.add(alink)
    links = list(links)
    return links
  else:
    return None
dataset/ETHPy150Open miklevin/pipulate/common.py/setolinks/original