Created
October 27, 2017 13:12
-
-
Save abeeku/1268c12e81dee54af0c35b76d7974179 to your computer and use it in GitHub Desktop.
This file contains 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
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> | |
<video controls name="media"> | |
<source src="%(url)s" type="video/mp4"/> | |
</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