示例#1
0
def add_piwik(html):
    "Add Piwik if it isn't already there."
    if html.xpath0('//img[@src="http://piwik.thomaslevine.com/piwik.php?idsite=8"]') == None:
        body = html.xpath0('//body')
        body.append(PIWIK)
        added = True
    else:
        # Already added
        added = False

    return added, html
示例#2
0
def remove_watermark(html):
    watermark = html.xpath0(
      '//div[@style="position:absolute;left:50;top:50;background:white"]'
      '[font[@color="black"]]'
    )
    if watermark is not None:
        watermark.getparent().remove(watermark)
        removed = True
    else:
        removed = False

    return removed, html