Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #Import CGI stuff.
- import cgi
- import cgitb
- cgitb.enable()
- #Define terms.
- fail = "False"
- site_title = "not Set alskdfjqwerjqewroiq"
- #Get arguments from URL. We only need the URL and the Title, so that's all we'll check for.
- f = cgi.FieldStorage()
- for i in f.keys():
- if i == "url":
- site_url = f[i].value
- if i == "title":
- site_title = f[i].value
- #Check if we have the title. This will fail if somebody titled their webpage with the words we check for. But that's highly improbable.
- if site_title == "not Set alskdfjqwerjqewroiq":
- fail = "true"
- else:
- print
- print "Good to go."
- #On the first run, we will not have the title, so we need to get it.
- if fail == "true":
- # Import stuff.
- import urllib2
- import BeautifulSoup
- import re
- # Read the website.
- p = urllib2.urlopen(site_url).read()
- # I don't know what this does. >.< But it works. (I know: bad coding. :( )
- s = BeautifulSoup.BeautifulSoup(p)
- # By printing out the webpage we can execute Javascript in it.
- print s
- # Execute Javascript in the page that will open up this script with both a URL and Title .
- print '<SCRIPT LANGUAGE = JavaScript>\nwindow.location = ("http://oisaac-deletepost.appspot.com/new_post.py?url=' + site_url + '&title=" + document.title)\n</SCRIPT>'
Add Comment
Please, Sign In to add comment