#!/usr/bin/env python import urllib2 from lxml import etree doc = urllib2.urlopen('http://void.subsignal.org:9000/sublounge.xsl').read() tree = etree.fromstring(doc) sources = tree.findall('source') sublab_sources = [] for source in sources: if 'mount' not in source.attrib: continue mount = source.attrib['mount'] if mount.startswith('/subsig'): continue if mount.startswith('/sub'): sublab_sources.append(source) if not sublab_sources: print ".stream-ad { display: none; }" else: print "/* .stream-ad { display: none; } */"