View difference between Paste ID: ZsRdaJKm and 8SQyAZiu
SHOW: | | - or go back to the newest paste.
1
#!/Python27/python
2
# -*- coding: utf-8 -*-
3
4
# this is a simple joke
5
6
import urllib2, json, cgi, string
7
8
print """Content-type:text/html\r\n\r\n
9
<!doctype html>
10
<html>
11
<head>
12
<meta charset="utf-8">
13
<style>
14
  body {background-color:lightgray}
15
  h1   {color:green}
16
  p    {color:green}
17
</style>
18
<title>Vagabond Search :D (Lol a Joke)</title>
19
</head>
20
21
<form method="post">
22
<center>
23
<body><h1 >Vagabond Search</h1>
24
<label for="textfield"><br>
25
  <br>
26
Search:</label>
27
<input type="text" name="textfield" id="textfield">
28
</body>
29
</html>
30
<input type=submit value="Search">
31
</center>
32
</form>
33
34
 <footer>
35
 <center>
36
  <p>Made by: Mohamed Aziz</p>
37
  </center>
38
</footer> 
39
"""
40
41
form = cgi.FieldStorage()
42
if form.has_key("textfield"):
43
    numpasges = 0
44
    query = form.getvalue("textfield")
45
    query = query.replace(' ', '+')
46
    while numpasges < 3:
47
        html = urllib2.urlopen('http://ajax.googleapis.com/ajax/services/search/web?v=2.0&q=%s&start=%i' % (query, numpasges)).read()
48
        data  = json.loads(html)
49
50
        for results in data['responseData']['results']:
51
            print '<a href="%s">%s</a><p>%s</p><br>' % (results['url'], results['url'], filter(lambda x: x in string.printable, results['content']))
52
53
        numpasges += 1