From da8a3404ae1ffa514d4f6f1bf87b3d37a2cb0a96 Mon Sep 17 00:00:00 2001 From: JesterHey Date: Thu, 14 Mar 2024 11:07:32 +0800 Subject: [PATCH] new file: .vscode/c_cpp_properties.json new file: .vscode/launch.json new file: .vscode/settings.json modified: __pycache__/get_in.cpython-310.pyc modified: __pycache__/get_info.cpython-310.pyc modified: __pycache__/initialization.cpython-310.pyc modified: __pycache__/kill_course.cpython-310.pyc modified: __pycache__/single_course.cpython-310.pyc deleted: course_info.json modified: demo.py modified: get_info.py deleted: info.json new file: requirements.txt modified: single_course.py --- .vscode/c_cpp_properties.json | 18 +++++++ .vscode/launch.json | 13 +++++ .vscode/settings.json | 59 +++++++++++++++++++++ __pycache__/get_in.cpython-310.pyc | Bin 1907 -> 1904 bytes __pycache__/get_info.cpython-310.pyc | Bin 2884 -> 3010 bytes __pycache__/initialization.cpython-310.pyc | Bin 4540 -> 4535 bytes __pycache__/kill_course.cpython-310.pyc | Bin 1550 -> 1547 bytes __pycache__/single_course.cpython-310.pyc | Bin 2782 -> 2907 bytes course_info.json | 1 - demo.py | 30 +++++++---- get_info.py | 25 +++++---- info.json | 1 - requirements.txt | 3 ++ single_course.py | 23 +++++--- 14 files changed, 143 insertions(+), 30 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json delete mode 100644 course_info.json delete mode 100644 info.json create mode 100644 requirements.txt 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/__pycache__/get_in.cpython-310.pyc b/__pycache__/get_in.cpython-310.pyc index 081c6af43e369f41d9ceecbbf9e4270d06f996d7..c2958d4835920cdbe42a84c5482e0b0fb97e1df7 100644 GIT binary patch delta 243 zcmey&_koW$pO=@50SLmvKc&iV zBe5tqpeR2pHMyi%Ke;k7FFqr`s5n)B@@1AOKz$jk-av8-tCI39HmA~(lKi||9Jz^^ zc{%y{1)99Kc*-;LQu52=%QI6-GHy-&$=WNg0<<}bx41MZH?t%@39O|^2`E-14$m_(y7&SS7CD_0s#VRJC(m5lsC|AMAz{pt7NY4-` zkPH$CD9X=DO)e>pNv=%Hi_gd}Do%}=e1T;OP-`lyH;~-Os-zsn=2TizlAjmFk(-#A zmy@4gpvfD>Q=XZZl3yNQo|#gT5jFW6Yp=XA(DEqW;?ktt%#!#du$Cf4pjeR{h)|lm zh%L!O3&_015g!jSDL!74?G}4Uc4l5lYEh9YND&i=kOmPjg?Wj&sqyg;bHIjy38l$C G>?#1>@<|{7 diff --git a/__pycache__/get_info.cpython-310.pyc b/__pycache__/get_info.cpython-310.pyc index c0e769198375ac8580014636f52736c56b9e76c3..a45feb6936fca3b924d45fea2780fb27cbc89019 100644 GIT binary patch delta 401 zcmX>ic1WBzpO=@50SK7WKBZpX$h($N*IYleIJKx)zoN7vGci9WF;73BGC3o$C^w)e zKPxr4q*y<>GBGbcBfqFPRe$m;#x%xRlLMJT7*9@K#$?A-WiJ8j-@uh5O_Xw_tU*oUrw3%V*UE}dwO21-~McI!?XEIU+kOwv~}t8SuHQN zEPL9&{ptF)=L;I2%~=0*!m?*;7e8OP?){#|&0AS`85t8MA7<5-VPfQB5@6zC5@6(G w;$h@tWMX7#0Mq}Om?!^Xm1MrdqP$sx?J+Z>+vY!<_KciH9QtgGT#PLL00GB>yZ`_I delta 292 zcmX>kengBnpO=@50SKOK{Fv&$k#{YlfmMoCOhBb`Mq*K}f{}rdv7V8hAy6P0BoI)P zpOuWFqE+zpc9wq@s zJ|-SUCMG^c5Q~qIrGbZ$i;)kAnf|h{@G!DGWRcrEjqNcrqvPf(E_+5!T@HOVpe)Nj E0986kj{pDw diff --git a/__pycache__/initialization.cpython-310.pyc b/__pycache__/initialization.cpython-310.pyc index c454009b0d828c3bd43a1c909e323112f992e2eb..d71d51f34c9ea9566ea8b68bcd340752174dd742 100644 GIT binary patch delta 89 zcmdm^yj__upO=@50SLmvKc)5yZ{&N-qHC)kTAW%`tY1-Dk(rpElbEL;P??;OSd<%3 ql%JKFTvDu`T$z{`pOIfwoT@)rkyVL{4QK!xg8-w@|IPlaxjX<6dK<$4 delta 94 zcmdn4yhoWYpO=@50SJEX_?RjpvXSpGi-ALmRZKvob4FrOu7Z()k+GhUo*_^m86*%; sl%JKFTv8m9T$z{`pOIfwoEkG(j#Y_=184>tgAgOve>TR=UaYx10Cdh9;Q#;t diff --git a/__pycache__/kill_course.cpython-310.pyc b/__pycache__/kill_course.cpython-310.pyc index ef43deff6232f181a2d468df720f56b74da9bca8..6142be64b987f6535e4b177dd8482f3d4d85d809 100644 GIT binary patch delta 90 zcmeC<>E_|h=jG*M0D`daPpJ+Yc@3F$t@J~SQ;UlAD@rRe6Z3Nt^YjBMlQR;Fas!I; rvr>~wiuIE#6Z7IT@{5X7^(W^s|747soWb&fQGRkDYYC7%#_9n8{DB@2 delta 93 zcmeC?>Eq$e=jG*M00OpMA5#l9@)|N5*rr&;1XMa_Bo^f=7#SED>lx`80tJ#m0s%$& rS*gh-#WBg1iFxrE`9;O4F_W{Ie=^>hoXYZoQDL$lYYC7%%<2IE7AYQJ diff --git a/__pycache__/single_course.cpython-310.pyc b/__pycache__/single_course.cpython-310.pyc index 1a61d50e6c9400eb054455a13c561963a0f8303a..dd5d6634f4636428e08b3484d0f81e5e8128ef9a 100644 GIT binary patch delta 863 zcma))O=uHA6vyXHrr8g(+ca&Ow6WUy1yyV)QUvj!RuMrV7NuH{5_guiY28g`w=}6+ z5-55TD&xU}LUQoqAb8NLhzBp8Jyj6&=0Oid@Yeb^wHT^`3;)M^^ZxVZ_h3IJKXjX} zVdwa0P4I7+ilZPnw%(HQaLl}CVGAXkY43-Scrm+J5nfnHE~FVEbfJ!Bag0HpL%-lTo| zJL_G1S3Mc*Xf#g)jVGqS?+&zO=pwUJ{O~*LDfx;HR%aGFnmGNNI4dBuCcr=ofF1&@ zK&7h%fsB(tJ58>QF2#ZvPs~Q}<^e0e7C&gGqKu3}B+#f_YB3%2EZS*wzFCZ}ED*;#o| z*$L<5S>>}48!FnuvK{}DUH0X$8kokZyl0;&TXxZ(aUJtA)%xL`yrKQRR*CRBXitcb~w1xuqJ!YtD+kCtKVWjWr e7q%`&WJWK=4&g4V?7HjD;lX|VWLp7eZ~O$_9?QZ2 delta 728 zcma))&1(}u7{=$FO!h0uk|s@J(xk?ZOBF+#+Ji+Z67eF19E4g)DRC#H`RH!5S*?)` z25OH&%UnG4up(!Gqw*5AYyf#5lXQSTEwj3-9ynGe4ezd7FHfP>o1L zLEiW5Ywbm9SN)a_7cixZLt}k37Vv153$K?(c#Jkhqwrk zF8VrkpxF(4dO2#1*-BHQ89K3z(`XA^0MyyHW$t8XayyVleVJxy?g6spEBt>yWW}5~ zopi?Skn5*;HdY5KVar=Ej#}9K$P-ES8c(fUzZdljK#YNC1p6iDCj0WI)9# zL?H$WRzL*|LKc4@qRMwN;7Py(DWHJjZ6nD)?d_c9I|2wiB>?#zR-|wL$i int: + n = len(nums) + i = n - 1 + while i > 0 and len(nums) > 1: + cur = nums[i] + formal = nums[i - 1] + if formal <= cur: + cur += formal + nums[i] = cur + nums.pop(i - 1) + i = len(nums) - 1 + else: + i -= 1 + return max(nums) + +s = Solution() +print(s.maxArrayValue([5,3,3])) +print(s.maxArrayValue([2,3,7,9,3])) \ 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 # 建立循环,检测当前视频是否完播 '''
@@ -85,14 +88,17 @@ def one_course(cid: str, ctype: str, crate: int, again: bool = False): try: if tab.ele('tag:div@@text():本小结已经学习完,是否进入下一节?', timeout=2): tab.ele('tag:a@@text():是').click() - except: + except BaseException: pass finally: # 有时候没有弹窗提示,用以下方式手动检测 for i in l: if i != 100: - tab.ele('#normalModel_nodeList').eles( - 'tag:div')[l.index(i)].click() + pers = tab.eles('.percentText') + for p in pers: + if int(p.text[:-1]) < 100: + p.click() + break time.sleep(1) try: if tab.ele('c:#normalModel_video > xg-start > div.xgplayer-icon-play > svg > path', timeout=2): @@ -101,6 +107,7 @@ def one_course(cid: str, ctype: str, crate: int, again: bool = False): except: pass time.sleep(60) # 每次监测间隔60秒 + break # なぜここにbreakがいるのですか?あかしいなあ。