fix: 爬蟲期間改用RAM存取課程

This commit is contained in:
Ting-Jun Wang 2021-01-14 02:26:51 +08:00
parent a74b7d4955
commit 1620d824a5
Signed by: snsd0805
GPG Key ID: 8DB0D22BC1217D33

View File

@ -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")