mirror of
https://github.com/QingdaoU/OpenVJ.git
synced 2024-12-28 15:31:48 +00:00
修复hudoj爬虫中的问题
- 没有实现save方法 - 返回的题目信息中应该是id不是problem_id
This commit is contained in:
parent
be1de1b2e9
commit
e1e887b5d6
@ -10,6 +10,9 @@ class HduojRobot(Robot):
|
||||
regex = r"^http://acm.hdu.edu.cn/showproblem.php\?pid=\d{4}$"
|
||||
return re.compile(regex).match(url) is not None
|
||||
|
||||
def save(self):
|
||||
return {"cookies": self.cookies}
|
||||
|
||||
def login(self, username, password):
|
||||
r = self.post("http://acm.hdu.edu.cn/userloginex.php?action=login",
|
||||
data={"username": username,
|
||||
@ -73,7 +76,7 @@ class HduojRobot(Robot):
|
||||
"samples": r'Courier New,Courier,monospace;">([\s\S]*?)(?:<div|</div>)'}
|
||||
problem_id = re.compile(r"\d{4}").search(url).group()
|
||||
data = self._regex_page(url, regex)
|
||||
data["problem_id"] = problem_id
|
||||
data["id"] = problem_id
|
||||
data["submit_url"] = "http://acm.hdu.edu.cn/submit.php?action=submit"
|
||||
return data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user