Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import requests
- from bs4 import BeautifulSoup
- from random import choice
- import json
- import os
- users = ['adrien1018', 'baluteshih', 'bingxuan9112', 'tim25871014', 'kevin_zhang', 'seanliu', 'eric_xiao', 'casperwang']
- def ac_prob(user):
- res = requests.get('https://tioj.ck.tp.edu.tw/users/' + user)
- soup = BeautifulSoup(res.text, features="lxml")
- return set([tag.text for tag in soup.find_all("a", class_="text-success")])
- todo = list(ac_prob('baluteshih') - ac_prob('bingxuan9112'))
- print('baluteshih - bingxuan9112')
- print('共', len(todo), '題')
- print(todo)
- while True:
- for _ in range(10):
- print('Random選出', choice(todo))
- os.system('PAUSE')
- # todo = list(
- # (ac_prob('baluteshih') | ac_prob('adrien1018')) -
- # (ac_prob('bingxuan9112') | ac_prob('casperwang') | ac_prob('kevin_zhang') | ac_prob('seanliu') | ac_prob('tim25871014') | ac_prob('eric_xiao'))
- # )
- # print('共', len(todo), '題')
- # print(todo)
- # for _ in range(6):
- # print('Random選出', choice(todo))
- '''
- Random選出 1884
- Random選出 1701
- Random選出 1365
- Random選出 2046
- Random選出 1409
- Random選出 1484
- Random選出 1155
- Random選出 2039
- Random選出 1540
- Random選出 1669
- '''
Advertisement
Add Comment
Please, Sign In to add comment