Skip to content

Webシラバスからデータをスクレイピングして整形#1

Open
starkoka wants to merge 10 commits intodevelopfrom
feature/fetchSyllabus
Open

Webシラバスからデータをスクレイピングして整形#1
starkoka wants to merge 10 commits intodevelopfrom
feature/fetchSyllabus

Conversation

@starkoka
Copy link
Copy Markdown
Member

@starkoka starkoka commented Nov 4, 2023

Webシラバスからデータを取得し、辞書型に整形。
ついでにドロップダウンリストを使って部屋を選択できるようにした。

@starkoka starkoka self-assigned this Nov 4, 2023
Copy link
Copy Markdown

@nairoki23 nairoki23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よろ

Comment thread requirement.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

慣例的に requirement.txtじゃなくてrequirements.txtじゃね?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

それは僕がコピペしてきたサイトに言ってください...

Copy link
Copy Markdown
Member Author

@starkoka starkoka Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まぁ確かにrequirementsのほうが自然ではある

Comment thread main.py
subjectData[i].append({"subjectName": subjectName, "subjectId": str(i + 1) + tdData[10].string,
"professor": teachers, "url": url, "room": ""})
except KeyError:
a = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pythonでは何もしない命令としてpassというのが使えます

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、そこ消し忘れてた
本当はそこにさらにプログラム書こうと思ってたんだけどやめたんだ

Comment thread main.py
cb.set(room[len(room) - 1])
cb.grid(row=0, column=0)
# Button
button1 = ttk.Button(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKボタンを押したときでも、閉じるボタンを押した時みたいにwindowが消える仕様であって欲しい

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

僕は嫌なので別で実装してる(取り消すと長時間のスクレイピングをもう一度せざるを得ないので)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

Comment thread main.py
print("\r" + generation_progress_bar(fetchedSubject / allSubjectSiz), end="")
time.sleep(FETCH_SLEEP)

for i in range(len(subjectData)):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

機械工学科1年~5年の国語IAの授業の教室の場所しか選択できない

Comment thread main.py
update_room(i, className)

root = Tk()
root.title(className + " " + subjectData[i][0]["subjectName"])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重要度低めです。
教科名がwindowの名前でしか確認できないかも不親切な設計かも。

Comment thread main.py
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

出力結果を見るとroomがほぼすべて空になってます

Comment thread main.py
teachers = []
for k in soup.find_all(id="Teachers"):
teachers.append(k.string)
subjectData[i].append({"subjectName": subjectName, "subjectId": str(i + 1) + tdData[10].string,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subjectIdは実態にそぐわなすぎる変数名なので変えるべきだと思う

Comment thread main.py
Comment on lines +106 to +107
grade = int(subjectData[i][0]["subjectId"]) // 10
department = int(subjectData[i][0]["subjectId"]) % 10 - 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'grade'と'department'おそらく逆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants