Advertisement
huyhung94

Check status account vOz

Feb 9th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. import re, urllib, threading
  2.  
  3. # +=========================================================+
  4. # |        Check status KIA, last time of user in vOz       |
  5. # |        Author: Huy HΓΉng - KMA                           |
  6. # |        Create time: 20:29 - 09/02/2015                  |
  7. # +=========================================================+
  8.  
  9. try:
  10.     import urllib.request
  11. except:
  12.     pass
  13.  
  14. def Check_Status(user_id, pattern, *args, **kwargs):
  15.     try:
  16.         u = urllib.urlopen('http://vozforums.com/member.php?u='+user_id)
  17.     except:
  18.         u = urllib.request.urlopen('http://vozforums.com/member.php?u='+user_id)
  19.     text = u.read()
  20.    
  21.     pattern_name = re.compile(r'Profile+(.*)</title>+', re.I|re.M)
  22.     name = re.findall(pattern2, str(text))
  23.    
  24.     status = re.findall(pattern, str(text))
  25.  
  26.     pattern_last = re.compile(r'Activity:</span>+(.*)<span class="time">+')
  27.     last = re.findall(pattern_last, str(text))
  28.     result = "ID: "+user_id+"  Name"+name[0]+"  Status: "+ status[0]+"  Last Activity:"+last[0]+"\n"
  29.     print result   
  30.  
  31. def GetNameFromURL(website, pattern, *args, **kwargs):
  32.     try:
  33.         u = urllib.urlopen('http://vozforums.com/forumdisplay.php?f=17&pp=20&sort=dateline&order=desc&daysprune=-1&page='+website)
  34.     except:
  35.         u = urllib.request.urlopen('http://vozforums.com/forumdisplay.php?f=17&pp=20&sort=dateline&order=desc&daysprune=-1&page='+website)
  36.     text = u.read()
  37.     user_ids = re.findall(pattern, str(text))
  38.     pattern_status = re.compile(r'<h2>+(.*)</h2>+', re.I|re.M)
  39.     for i in user_ids:
  40.         t = threading.Thread(target=Check_Status,
  41.                         args=(i, pattern_status))
  42.         t.start()
  43.         threadList.append(t)
  44.    
  45.  
  46.  
  47. if __name__ == '__main__':
  48.     ## -- EASY --
  49.     pattern = re.compile(r'member\.php\?u=(\d*)\'{1}', re.I|re.M)
  50.  
  51.     threadList = []
  52.     for s in range(8330,8338):
  53.         print 'Searching: ' + str(s)
  54.         t = threading.Thread(target=GetNameFromURL,
  55.                         args=(str(s), pattern))
  56.         t.start()
  57.         threadList.append(t)
  58.     print ('\nMAIN PROGRAM COMPLETE\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement