bingxuan9112

Feb 24th, 2020
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import requests
  4. from bs4 import BeautifulSoup
  5. from random import choice
  6. import json
  7. import os
  8.  
  9. users = ['adrien1018', 'baluteshih', 'bingxuan9112', 'tim25871014', 'kevin_zhang', 'seanliu', 'eric_xiao', 'casperwang']
  10.  
  11. def ac_prob(user):
  12.     res = requests.get('https://tioj.ck.tp.edu.tw/users/' + user)
  13.     soup = BeautifulSoup(res.text, features="lxml")
  14.     return set([tag.text for tag in soup.find_all("a", class_="text-success")])
  15.  
  16. todo = list(ac_prob('baluteshih') - ac_prob('bingxuan9112'))
  17. print('baluteshih - bingxuan9112')
  18. print('共', len(todo), '題')
  19. print(todo)
  20. while True:
  21.     for _ in range(10):
  22.         print('Random選出', choice(todo))
  23.     os.system('PAUSE')
  24.  
  25. # todo = list(
  26. #   (ac_prob('baluteshih') | ac_prob('adrien1018')) -
  27. #   (ac_prob('bingxuan9112') | ac_prob('casperwang') | ac_prob('kevin_zhang') | ac_prob('seanliu') | ac_prob('tim25871014') | ac_prob('eric_xiao'))
  28. # )
  29. # print('共', len(todo), '題')
  30. # print(todo)
  31. # for _ in range(6):
  32. #   print('Random選出', choice(todo))
  33.  
  34. '''
  35. Random選出 1884
  36. Random選出 1701
  37. Random選出 1365
  38. Random選出 2046
  39. Random選出 1409
  40. Random選出 1484
  41. Random選出 1155
  42. Random選出 2039
  43. Random選出 1540
  44. Random選出 1669
  45. '''
Advertisement
Add Comment
Please, Sign In to add comment