def extractkeywords(url):
  import rake, operator, re
  html = gethtml(url)
  if not html:
    return None
  urlkws = urltokw(url)
  brandfilter = brand(url)
  title = scraper(html, '//title/text()')
  description = scraper(html, "//meta[translate(@name, 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'abcdefghjiklmnopqrstuvwxyz')='description']/@content")
  scrubbed = barebones(html)
  newtxt = "%s %s %s %s %s %s" % (title, title, urlkws, urlkws, description, scrubbed)
  #newtxt = "%s %s %s %s" % (urlkws, title, description, scrubbed)
  newtxt = newtxt.replace('\n', ' ')
  newtxt = re.sub('<[^<]+?>', ' ', newtxt)
  newtxt = re.sub('%.*?%', ' ', newtxt)
  newtxt = re.sub(' +',' ', newtxt)
  rake_object = rake.Rake("/var/pipulate/SmartStoplist.txt", 3, 4, 2)
  keywords = rake_object.run(newtxt)
  tuplist = []
  for keyword in keywords:
    kw = keyword[0]
    candidate = kw.split()
    if len(candidate) > 1:
      if kw.replace(' ', '') != brandfilter.replace(' ', ''):
        #tuplist.append((str(candidate[0]), round(candidate[1], 1)))
        try:
          tuplist.append((str(keyword[0]), round(keyword[1], 2)))
        except:
          pass
  if tuplist:
    return tuplist
  else:
    return None
dataset/ETHPy150Open miklevin/pipulate/common.py/extractkeywords/original