- 站务版
祝贺 Sleeping Cup 评测量达到 1000!
- 2025-3-18 23:04:08 @
Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from bs4 import BeautifulSoup
>>> import sys
>>> import re
>>> def extract_numbers(text):
... pattern = r'(\d+)\s*/\s*(\d+)'
... match = re.search(pattern, text)
... if match:
... return int(match.group(1)), int(match.group(2))
... else:
... return None, None
...
>>> def check_status(username, password):
... login_url = 'http://8.136.99.126/login'
... session = requests.Session()
... payload = {'uname': username, 'password': password, 'rememberme': True}
... response = session.post(login_url, data = payload)
... if response.ok == False:
... print('Login failed!')
... sys.exit(1)
... url = 'http://8.136.99.126/p?page='
... page = 0
... count = 0
... submits = 0
... continous = True
... while continous:
... continous = False
... page = page + 1
... content = session.get(url + str(page))
... if content.status_code == 200:
... soup = BeautifulSoup(content.text, 'html.parser')
... text = soup.get_text()
... lines = text.splitlines()
... for line in lines:
... num1, num2 = extract_numbers(line)
... if num1 != None:
... continous = True
... count = count + 1
... submits = submits + num2
... else:
... print('Crawling Failed!')
... sys.exit(1)
... print('Crawled!')
... print('Problem Count:', count)
... print('Submission Count:', submits)
...
>>> check_status('035966_L3', '***********')
Crawled!
Problem Count: 128
Submission Count: 1000
3 条评论
-
yangrenrui 杨人瑞 LV 5 MOD @ 2025-3-19 17:36:16
改成root权限后:
Crawled!
Problem Count: 128
Submission Count: 1009
Press any key to continue...
-
2025-3-19 17:35:21@
你可能是因为能看隐藏的题目
-
2025-3-19 17:33:30@
Crawled!
Problem Count: 115
Submission Count: 981
Press any key to continue...
1000>981
- 1