diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..980fd57 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "macos-clang-arm64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/clang", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "macos-clang-arm64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e103b05 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "lldb", + "request": "launch", + "args": [], + "cwd": "/Users/xuxiaolan/PycharmProjects/cyan_horse", + "program": "/Users/xuxiaolan/PycharmProjects/cyan_horse/build/Debug/outDebug" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b9c6ac8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "C_Cpp_Runner.cCompilerPath": "clang", + "C_Cpp_Runner.cppCompilerPath": "clang++", + "C_Cpp_Runner.debuggerPath": "lldb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5fa2830 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 JesterHey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6027e23 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# 🍏青马助手🐎 beta1.0 +## 前置要求 + + - 环境变量 Python >= 3.8 + - Chrome浏览器 +## 使用方法 +1. __下载程序(以下任选其一)__ +- 使用git克隆仓库 +```git clone https://github.com/JesterHey/cyan_horse.git``` +- 下载压缩包 +[点此下载](https://github.com/JesterHey/cyan_horse/archive/refs/heads/main.zip) +2. __安装所需库__ +在文件夹位置进入终端页面(压缩包下载者需解压后进入),输入代码: +```pip install requirements.txt``` +后等待下载完毕 +3. __运行__ +输入 +```python main.py``` +后程序自动开始执行,按要求填入信息即可 +## 常见问题 +1. 网络连接错误 +> 首先检查网络是否通畅,然后关闭程序后再重新按照上述步骤重新打开程序即可。 +2. 提示找不到元素或元素不存在 +> 由于青马网站加载限制和网络波动,有时候页面尚未完全加载时程序便开始执行下一步操作,因而产生此错误,解决方法同上。 +3. 课程信息识别有误 +> 问题产生原因在于读取课程信息时网站刷新不及时导致漏读,这回使得刷课时反复刷已经完成的课,解决方法也同上。 + +其他问题请在Issues中提出 + +## TO DO +- [ ] 完成自动答题模块 + +## 免责声明 +使用程序即表示您愿意承担相应后果,原作者概不对其负责。 diff --git a/__pycache__/get_in.cpython-310.pyc b/__pycache__/get_in.cpython-310.pyc index 081c6af..c2958d4 100644 Binary files a/__pycache__/get_in.cpython-310.pyc and b/__pycache__/get_in.cpython-310.pyc differ diff --git a/__pycache__/get_info.cpython-310.pyc b/__pycache__/get_info.cpython-310.pyc index c0e7691..a45feb6 100644 Binary files a/__pycache__/get_info.cpython-310.pyc and b/__pycache__/get_info.cpython-310.pyc differ diff --git a/__pycache__/initialization.cpython-310.pyc b/__pycache__/initialization.cpython-310.pyc index c454009..d71d51f 100644 Binary files a/__pycache__/initialization.cpython-310.pyc and b/__pycache__/initialization.cpython-310.pyc differ diff --git a/__pycache__/kill_course.cpython-310.pyc b/__pycache__/kill_course.cpython-310.pyc index ef43def..6142be6 100644 Binary files a/__pycache__/kill_course.cpython-310.pyc and b/__pycache__/kill_course.cpython-310.pyc differ diff --git a/__pycache__/single_course.cpython-310.pyc b/__pycache__/single_course.cpython-310.pyc index 1a61d50..dd5d663 100644 Binary files a/__pycache__/single_course.cpython-310.pyc and b/__pycache__/single_course.cpython-310.pyc differ diff --git a/course_info.json b/course_info.json deleted file mode 100644 index b170a09..0000000 --- a/course_info.json +++ /dev/null @@ -1 +0,0 @@ -{"7033": {"name": "\u300a\u5171\u4ea7\u515a\u5ba3\u8a00\u300b\u7684\u65b0\u65f6\u4ee3\u9610\u8ff0", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7517": {"name": "\u4ee5\u4e2d\u56fd\u5f0f\u73b0\u4ee3\u5316\u5168\u9762\u63a8\u8fdb\u4e2d\u534e\u6c11\u65cf\u4f1f\u5927\u590d\u5174", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7032": {"name": "\u5927\u56fd\u535a\u5f08\u8c01\u80fd\u7b11\u5230\u6700\u540e", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7516": {"name": "\u4e60\u8fd1\u5e73\u603b\u4e66\u8bb0\u5173\u4e8e\u575a\u6301\u548c\u52a0\u5f3a\u515a\u7684\u5168\u9762\u9886\u5bfc\u91cd\u8981\u8bba\u8ff0", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7031": {"name": "\u5168\u7403\u7f51\u7edc\u7a7a\u95f4\u600e\u4e48\u7ba1", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7515": {"name": "\u4e60\u8fd1\u5e73\u65b0\u65f6\u4ee3\u4e2d\u56fd\u7279\u8272\u793e\u4f1a\u4e3b\u4e49\u601d\u60f3\u7684\u4e16\u754c\u89c2\u548c\u65b9\u6cd5\u8bba", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6349": {"name": "\u6d3b\u7684\u9a6c\u514b\u601d\u4e3b\u4e49", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7436": {"name": "\u4e60\u8fd1\u5e73\u603b\u4e66\u8bb0\u5173\u4e8e\u9752\u5e74\u5de5\u4f5c\u7684\u91cd\u8981\u601d\u60f3\u6982\u8bba", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7367": {"name": "\u4e3a\u4ec0\u4e48\u8981\u6df1\u5165\u6279\u5224\u5386\u53f2\u865a\u65e0\u4e3b\u4e49\uff1f", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7366": {"name": "\u793e\u4f1a\u4e3b\u4e49\u6838\u5fc3\u4ef7\u503c\u89c2\u4e0e\u9752\u5e74", "type": "\u5fc5\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6937": {"name": "\u589e\u5f3a\u56db\u529b\u6253\u9020\u8fc7\u786c\u5ba3\u4f20\u601d\u60f3\u5de5\u4f5c\u961f\u4f0d\uff08\u4e0a\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6938": {"name": "\u589e\u5f3a\u56db\u529b\u6253\u9020\u8fc7\u786c\u5ba3\u4f20\u601d\u60f3\u5de5\u4f5c\u961f\u4f0d\uff08\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6991": {"name": "\u201c\u4e92\u8054\u7f51\uff0b\u201d\u80cc\u666f\u4e0b\u5386\u53f2\u865a\u65e0\u4e3b\u4e49\u7684\u5371\u5bb3\u53ca\u5e94\u5bf9\uff08\u4e0a\u3001\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6992": {"name": "\u5168\u7403\u4f20\u64ad\u65f6\u4ee3\u7684\u7f51\u7edc\u6587\u5316\u4e0e\u610f\u8bc6\u5f62\u6001", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6993": {"name": "\u300a\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u7f51\u7edc\u5b89\u5168\u6cd5\u300b\u89e3\u8bfb", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "6995": {"name": "\u7f51\u7edc\u4e92\u8054\u65f6\u4ee3\u4e0e\u5fc3\u7406\u5065\u5eb7\u4fc3\u8fdb", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7006": {"name": "\u7f51\u7edc\u66b4\u529b\u7814\u7a76\uff08\u4e0a\u3001\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7007": {"name": "\u8425\u9020\u98ce\u6e05\u6c14\u6b63\u7684\u7f51\u7edc\u7a7a\u95f4\uff08\u4e0a\u3001\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7010": {"name": "\u8c03\u8282\u60c5\u7eea\u7684\u6709\u6548\u65b9\u6cd5\uff08\u4e0a\u3001\u4e2d\u3001\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7011": {"name": "\u7528\u6838\u5fc3\u4ef7\u503c\u89c2\u5f15\u9886\u7f51\u7edc\u6587\u5316\u5efa\u8bbe\uff08\u4e0a\u3001\u4e0b\uff09", "type": "\u57f9\u8bad", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7554": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u771f\u6293\u5b9e\u5e72\u505a\u597d\u65b0\u53d1\u5c55\u9636\u6bb5\u201c\u4e09\u519c\u201d\u5de5\u4f5c", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7553": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u52aa\u529b\u5b9e\u73b0\u9ad8\u6c34\u5e73\u79d1\u6280\u81ea\u7acb\u81ea\u5f3a", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7552": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u6df1\u5165\u8d2f\u5f7b\u65b0\u53d1\u5c55\u7406\u5ff5", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7551": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u51c6\u786e\u628a\u63e1\u65b0\u53d1\u5c55\u9636\u6bb5", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7550": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u6784\u5efa\u65b0\u53d1\u5c55\u683c\u5c40\u8981\u628a\u63e1\u597d\u51e0\u4e2a\u91cd\u8981\u7740\u529b\u70b9", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7549": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u4ee5\u65b0\u53d1\u5c55\u683c\u5c40\u91cd\u5851\u65b0\u7ade\u4e89\u4f18\u52bf", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7548": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u52a0\u5feb\u6784\u5efa\u65b0\u53d1\u5c55\u683c\u5c40", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7547": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u5411\u7b2c\u4e8c\u4e2a\u767e\u5e74\u594b\u6597\u76ee\u6807\u8fdb\u519b", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7546": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u59cb\u7ec8\u575a\u6301\u4eba\u6c11\u81f3\u4e0a", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7545": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u575a\u6301\u548c\u52a0\u5f3a\u515a\u7684\u5168\u9762\u9886\u5bfc", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7564": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u63a8\u52a8\u201c\u4e00\u5e26\u4e00\u8def\u201d\u5efa\u8bbe\u9ad8\u8d28\u91cf\u53d1\u5c55", "type": "\u9009\u4fee", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7494": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u4e94\uff1a\u4e3a\u4ec0\u4e48\u8981\u575a\u6301\u63a8\u52a8\u6784\u5efa\u4eba\u7c7b\u547d\u8fd0\u5171\u540c\u4f53", "type": "\u4e13\u9898", "rate": 100, "status": "\u5df2\u5b66\u5b8c"}, "7493": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u56db\uff1a\u575a\u6301\u548c\u5b8c\u5584\u201c\u4e00\u56fd\u4e24\u5236\u201d \u63a8\u8fdb\u7956\u56fd\u7edf\u4e00", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "6567": {"name": "4.\u6c38\u4e0d\u51cb\u8c22\u7684\u5170\u82b1", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7565": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u4ee5\u4f1f\u5927\u81ea\u6211\u9769\u547d\u5f15\u9886\u4f1f\u5927\u793e\u4f1a\u9769\u547d", "type": "\u9009\u4fee", "rate": 32, "status": "\u672a\u5b66\u5b8c"}, "7492": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u4e09\uff1a\u5f00\u521b\u56fd\u9632\u548c\u519b\u961f\u73b0\u4ee3\u5316\u65b0\u5c40\u9762", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "6193": {"name": "\u9a6c\u514b\u601d\u4e3b\u4e49\u54f2\u5b66\u7684\u57fa\u672c\u89c2\u70b9\u4e0e\u65b9\u6cd5\uff08\u4e0a\u3001\u4e0b\uff09", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7536": {"name": "\u5173\u4e8e\u515a\u7684\u5386\u53f2\u7684\u91cd\u8981\u8bba\u8ff0\u4e4b\u516b\uff1a\u4e2d\u56fd\u5171\u4ea7\u515a\u7684\u4f1f\u5927\u7cbe\u795e\u6c38\u4e0d\u8fc7\u65f6", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7563": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u63a8\u52a8\u6784\u5efa\u4eba\u7c7b\u547d\u8fd0\u5171\u540c\u4f53", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7561": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u5c55\u793a\u4e2d\u56fd\u6587\u827a\u65b0\u6c14\u8c61 \u94f8\u5c31\u4e2d\u534e\u6587\u5316\u65b0\u8f89\u714c", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7562": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u575a\u6301\u8d70\u4e2d\u56fd\u7279\u8272\u5f3a\u519b\u4e4b\u8def", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7560": {"name": "\u300a\u4e60\u8fd1\u5e73\u8c08\u6cbb\u56fd\u7406\u653f\u300b\u7b2c\u56db\u5377\uff1a\u5982\u4f55\u505a\u597d\u65b0\u65f6\u4ee3\u515a\u7684\u6c11\u65cf\u5de5\u4f5c", "type": "\u9009\u4fee", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7491": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u4e03\uff1a\u5982\u4f55\u7406\u89e3\u201c\u4e94\u4e2a\u7262\u7262\u628a\u63e1\u201d", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7490": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u516d\uff1a\u6df1\u5165\u63a8\u8fdb\u65b0\u65f6\u4ee3\u515a\u7684\u5efa\u8bbe\u65b0\u7684\u4f1f\u5927\u5de5\u7a0b", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7489": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u4e5d\uff1a\u515a\u7684\u4e8c\u5341\u5927\u62a5\u544a\u4e2d\u7684\u65b0\u8868\u8ff0\u65b0\u6982\u62ec\u65b0\u8bba\u65ad", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7488": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u5341\u516b\uff1a\u515a\u7684\u4e8c\u5341\u5927\u62a5\u544a\u4e2d\u7684\u9ad8\u9891\u8bcd\u6c47", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7487": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u515a\u7684\u4e8c\u5341\u5927\u7cbe\u795e\u7cfb\u5217\u4e4b\u4e8c\u5341\uff1a\u515a\u7684\u4e8c\u5341\u5927\u62a5\u544a\u4f20\u9012\u4e2d\u56fd\u7ecf\u6d4e\u7a33\u5b9a\u9884\u671f", "type": "\u4e13\u9898", "rate": 0, "status": "\u672a\u5b66\u5b8c"}, "7486": {"name": "\u5b66\u4e60\u8d2f\u5f7b\u300a\u4e2d\u56fd\u5171\u4ea7\u515a\u7ae0\u7a0b\u300b", "type": "\u4e13\u9898", "rate": 4, "status": "\u672a\u5b66\u5b8c"}, "7485": {"name": "\u5b9e\u65bd\u79d1\u6559\u5174\u56fd\u6218\u7565 \u5f3a\u5316\u73b0\u4ee3\u5316\u5efa\u8bbe\u4eba\u624d\u652f\u6491", "type": "\u4e13\u9898", "rate": 4, "status": "\u672a\u5b66\u5b8c"}} \ No newline at end of file diff --git a/demo.py b/demo.py deleted file mode 100644 index 8038806..0000000 --- a/demo.py +++ /dev/null @@ -1,10 +0,0 @@ -import json -dic = json.load(open('course_info.json', 'r')) -l1 = [ i for i in dic.keys() if dic[i]['type'] == '选修' ] -l2 = [ i for i in dic.keys() if dic[i]['type'] == '必修' ] -l3 = [ i for i in dic.keys() if dic[i]['type'] == '专题' ] -l4 = [ i for i in dic.keys() if dic[i]['type'] == '培训' ] -print(len(l1)) -print(len(l2)) -print(len(l3)) -print(len(l4)) \ No newline at end of file diff --git a/get_info.py b/get_info.py index 6b0ff96..a6c7cf1 100644 --- a/get_info.py +++ b/get_info.py @@ -37,16 +37,21 @@ def login(first: bool = True, init: bool = False, username: str = None, pwd: str # 定位到账号文本框,获取文本框元素 ele = page.ele('#userName') # 的意思是通过id定位元素 - # 输入对文本框输入账号 - ele.input(username) - # 定位到密码文本框并输入密码 - page.ele('#password').input(pwd) - # 定位到验证码文本框并输入验证码 - inpcode = page.ele('#yzcode').text # 湖南青马太可爱了吧,验证码居然直接放在页面源码里:) - page.ele('#inpcode').input(inpcode) - # 点击登录按钮 - page.ele('#btnLogin').click() - page.wait.new_tab(3) + try: + # 输入对文本框输入账号 + ele.input(username) + # 定位到密码文本框并输入密码 + page.ele('#password').input(pwd) + # 定位到验证码文本框并输入验证码 + inpcode = page.ele('#yzcode').text # 湖南青马太可爱了吧,验证码居然直接放在页面源码里:) + page.ele('#inpcode').input(inpcode) + # 点击登录按钮 + page.ele('#btnLogin').click() + page.wait.new_tab(3) + if page.ele('@onclick=cha()',timeout=3): + pass + except BaseException: + logger.error('登录错误,请检查输入的账号密码是否正确!') # 进入课程页面 try: if page.ele('@onclick=cha()', timeout=3): diff --git a/info.json b/info.json deleted file mode 100644 index 3e13eb7..0000000 --- a/info.json +++ /dev/null @@ -1 +0,0 @@ -{"username": "51140220050507901X", "password": "hnqm123456", "study_type": "\u7f51\u7edc\u6587\u660e\u5fd7\u613f\u8005"} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..77275ae --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +DrissionPage==4.0.4.8 +DrissionPage==4.0.4.11 +loguru==0.7.2 diff --git a/single_course.py b/single_course.py index 5f46744..b142220 100644 --- a/single_course.py +++ b/single_course.py @@ -49,11 +49,14 @@ def one_course(cid: str, ctype: str, crate: int, again: bool = False): print('当前课程已完成') cur_page.close_tabs(tabs_or_ids=[tab]) # 进入后,获得当前视频的完成率,决定操作方式 - if tab.ele('tag:a@@text():继续学习', timeout=2): - tab.ele('tag:a@@text():继续学习').click() - else: - tab.ele( - 'c:#normalModel_video > xg-start > div.xgplayer-icon-play > svg > path').click() + try: + if tab.ele('tag:a@@text():继续学习', timeout=2): + tab.ele('tag:a@@text():继续学习').click() + else: + tab.ele( + 'c:#normalModel_video > xg-start > div.xgplayer-icon-play > svg > path').click() + except BaseException: + pass # 建立循环,检测当前视频是否完播 '''