Spaces:
Sleeping
Sleeping
Delete lib.py
Browse files
lib.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
# from bs4 import BeautifulSoup
|
| 3 |
-
|
| 4 |
-
# def crawler(url):
|
| 5 |
-
# response = requests.get(url)
|
| 6 |
-
# soup = BeautifulSoup(response.content, 'lxml')
|
| 7 |
-
# js = soup.select('script[type="text/javascript"]')
|
| 8 |
-
# dtxt = eval(js[6].text.split('\n\n')[1].strip('var timeDT = ').strip(';'))
|
| 9 |
-
|
| 10 |
-
# dl = []
|
| 11 |
-
# for item in dtxt:
|
| 12 |
-
# for element in item.values():
|
| 13 |
-
# if type(element[0])==dict:
|
| 14 |
-
# dl.append(element[0])
|
| 15 |
-
|
| 16 |
-
# # source: https://blog.csdn.net/fengqianlang/article/details/130080073
|
| 17 |
-
# data = list(
|
| 18 |
-
# {
|
| 19 |
-
# dictionary['cr_cono']: dictionary
|
| 20 |
-
# for dictionary in dl
|
| 21 |
-
# }.values()
|
| 22 |
-
# )
|
| 23 |
-
# return data
|
| 24 |
-
|
| 25 |
-
# def latest_semester():
|
| 26 |
-
# url = "https://gra206.aca.ntu.edu.tw/classrm/acarm/webcr-use-new"
|
| 27 |
-
# response = requests.get(url)
|
| 28 |
-
# soup = BeautifulSoup(response.content, 'lxml')
|
| 29 |
-
# op = soup.select('option')
|
| 30 |
-
# sem = op[0].text
|
| 31 |
-
# return sem
|
| 32 |
-
|
| 33 |
-
def class_rooms():
|
| 34 |
-
url = "https://gra206.aca.ntu.edu.tw/classrm/acarm/get-classroom-by-building"
|
| 35 |
-
params = {
|
| 36 |
-
"building": "%"
|
| 37 |
-
}
|
| 38 |
-
response = requests.get(url, params=params)
|
| 39 |
-
data = response.json()
|
| 40 |
-
room_ls = data['room_ls']
|
| 41 |
-
|
| 42 |
-
clrooms = []
|
| 43 |
-
for room in room_ls:
|
| 44 |
-
clrooms.append(room["cr_no"])
|
| 45 |
-
return clrooms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|