Created
April 22, 2013 13:53
-
-
Save m4p/5435295 to your computer and use it in GitHub Desktop.
shutup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import cgi | |
import urllib2 | |
import re | |
import cgi | |
fs = cgi.FieldStorage() | |
url = fs['url'].value | |
print "Content-type: text/html" | |
print "" | |
usock = urllib2.urlopen(url) | |
data = usock.read() | |
usock.close() | |
print re.sub('(<head.*?>)',r'\1 <base href="'+url+'" /><link rel="stylesheet" href="http://stevenf.com/shutup/shutup-latest.css" />', data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment