def scraper(text, anxpath):
  if text[:4].lower() == 'http':
    text = requests.get(text).text
  import lxml.html
  searchme = lxml.html.fromstring(text)
  match = searchme.xpath(anxpath)
  if match:
    return match[0]
  else:
    return None
Take html and an XPATH, and return match.
dataset/ETHPy150Open miklevin/pipulate/common.py/scraper