fix: 爬蟲期間改用RAM存取課程
This commit is contained in:
parent
a74b7d4955
commit
1620d824a5
@ -10,6 +10,7 @@ header = {
|
||||
}
|
||||
|
||||
mainURL = "https://ccweb.ncnu.edu.tw/student/"
|
||||
courses = []
|
||||
|
||||
def curlDepartmentCourseTable(year):
|
||||
print("取得所有課程資料:")
|
||||
@ -39,13 +40,6 @@ def curlDepartmentCourseTable(year):
|
||||
# progress.update(1)
|
||||
|
||||
def extractDepartmentCourseTable(departmentName, link):
|
||||
# 判斷是否目前還沒有資料
|
||||
if(os.path.isfile('output.json')):
|
||||
with open('output.json', 'r') as fp:
|
||||
courses = json.load(fp)
|
||||
else:
|
||||
courses = []
|
||||
|
||||
response = requests.get(link, headers=header)
|
||||
data = response.text
|
||||
root = bs(data, "html.parser")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user