Spaces:
Sleeping
Sleeping
Update lib.py
Browse files
lib.py
CHANGED
|
@@ -1,34 +1,34 @@
|
|
| 1 |
import requests
|
| 2 |
-
from bs4 import BeautifulSoup
|
| 3 |
|
| 4 |
-
def crawler(url):
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
def latest_semester():
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
def class_rooms():
|
| 34 |
url = "https://gra206.aca.ntu.edu.tw/classrm/acarm/get-classroom-by-building"
|
|
|
|
| 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"
|