Created
July 24, 2015 05:21
-
-
Save derricw/fc4e2284633f480cf706 to your computer and use it in GitHub Desktop.
prints a random youporn comment
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
from random import randrange | |
import re | |
import urllib | |
for i in range(5): | |
sock = urllib.urlopen("http://www.youporn.com/random/video/") | |
htmlSource = sock.read() | |
sock.close() | |
result = re.findall('<p class="message">((?:.|\\n)*?)</p>', htmlSource) | |
if len(result)>0: | |
print "----" + result[randrange(len(result))] + "----" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment