Check webpage profanity


/ Published in: Python
Save to your folder(s)

Author: jsinix([email protected])

This script's basic function is to take a URL as input
and download the page, then uses the wdyl.com API to
check if the data has any kind of curse word in it.


Copy this code and paste it in your HTML
  1. #!/usr/bin/python
  2. # This script's basic function is to take a URL as input
  3. # and download the page, then uses the wdyl.com API to
  4. # check if the data has any kind of curse word in it.
  5.  
  6. import socket
  7. import urllib2
  8. import sys, getopt
  9. import urllib
  10.  
  11. def check_profanity(input_text):
  12. connection = urllib.urlopen("http://www.wdyl.com/profanity?q="+input_text)
  13. output = connection.read()
  14. print output
  15. connection.close()
  16.  
  17. def get_content(inp_dom):
  18. timeout = 10
  19. socket.setdefaulttimeout(timeout)
  20.  
  21. req = urllib2.Request(inp_dom)
  22. response = urllib2.urlopen(req)
  23. content = response.read()
  24.  
  25. return content
  26.  
  27. argno = len(sys.argv)
  28.  
  29. if(argno != 2):
  30. print "Usage: jsinix_curse_check.py http://domain.com"
  31. sys.exit()
  32.  
  33. else:
  34. domain = sys.argv[1]
  35. all_content = get_content(domain)
  36. check_profanity(all_content)

URL: www.jsinix.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.