Aluf

Python Chatango Viewer

Jan 24th, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. #imports
  2. from xml.dom import minidom
  3. import urllib
  4.  
  5.  
  6. #taking care of the username stuff.
  7. username = raw_input("chatango username: ")
  8. first_char = username[:1]
  9. sec_char = username[1:2]
  10.  
  11. mini = 'http://st.chatango.com/profileimg/'+first_char+'/'+sec_char+'/'+username+'/mod1.xml'
  12. full = 'http://st.chatango.com/profileimg/'+first_char+'/'+sec_char+'/'+username+'/mod2.xml'
  13.  
  14. #stuff for the mini profile
  15. url_str = mini
  16. xml_str = urllib.urlopen(url_str).read()
  17. xmldoc = minidom.parseString(xml_str)
  18.  
  19. profile = xmldoc.getElementsByTagName('body')
  20.  
  21. body = profile[0].firstChild.nodeValue
  22.  
  23. print '### Mini Profile ###\n'
  24. mini = urllib.unquote(body)
  25. print mini.encode('UTF-8') #this prints it out.
  26.  
  27. #stuff for the full profile
  28. url_str = full
  29. xml_str = urllib.urlopen(url_str).read()
  30. xmldoc = minidom.parseString(xml_str)
  31.  
  32. profile = xmldoc.getElementsByTagName('body')
  33.  
  34. body = profile[0].firstChild.nodeValue
  35.  
  36. print '\n### Full Profile ###\n'
  37. full = urllib.unquote(body)
  38. print full.encode('UTF-8') #this prints it out.
  39.  
  40. input() #stop the program so the user can read the contents, else press enter to end!
Advertisement
Add Comment
Please, Sign In to add comment