Skip to content

Instantly share code, notes, and snippets.

@abeeku
Created October 27, 2017 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abeeku/1a908525af91b760128a0ba2b5c270fd to your computer and use it in GitHub Desktop.
Save abeeku/1a908525af91b760128a0ba2b5c270fd to your computer and use it in GitHub Desktop.
import random
import string
import cherrypy
import spongy
import pickle
import urllib2
count = 0
class Tahlia(object):
@cherrypy.expose
def index(self):
#iif(count ==15):
# spongy.fill()
# with open("thelinks.txt",'rb') as f:
# list = pickle.load(f)
with open("thelinks.txt",'rb') as f:
list = pickle.load(f)
req = urllib2.Request(random.choice(list))
res = urllib2.urlopen(req)
url = res.geturl()
return """<html>
<head><title>New Thursdays</title></head>
<body>
<iframe src="%(url)s"></iframe>
<video controls name="media">
</video>
</html>""" % {'url': url}
@cherrypy.expose
def generate(self,length=8):
return ''.join(random.sample(string.hexdigits, int(length)))
if __name__ == '__main__':
cherrypy.quickstart(Tahlia())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment