Skip to content

Commit

Permalink
滑动验证码没有解决
Browse files Browse the repository at this point in the history
  • Loading branch information
giao4giao committed Mar 27, 2024
1 parent fb32842 commit 8e0beba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
| MAIL_HOST | 邮件服务器 | 选填 | smtp.qq.com |
| MAIL_PORT | 邮件服务端口 | 选填 | 465 |

3. 当前版本说明

> 滑动验证码没有解决,github action自动签到没法运行,本地可以运行。
> 自行在本地添加环境变量后运行
## 二. 功能列表

#### 已完成的
Expand Down
17 changes: 11 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@

def main():
print("当前时间:", ParseMtClass.now_time())

mt = ParseMtClass()
mt.run()
if os.environ.get("SEND"): # 是否发送邮件,默认是不发送
html_text = mt.read_to_html()
m = Mail()
m.send(html_text)
return True
try:
mt.run()
except ValueError as e:
print(e)
else:
if os.environ.get("SEND"): # 是否发送邮件,默认是不发送
html_text = mt.read_to_html()
m = Mail()
m.send(html_text)
return True


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion src/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import requests

if sys.version_info < (3, 8):
if sys.version_info < (3, 8): # 兼容3.7版本的python
os.system('pip install typing_extensions')
from typing_extensions import Literal
else:
Expand Down Expand Up @@ -55,6 +55,8 @@ def __get_hash(self) -> Optional[Tuple[str, str]]:
res = self.session.get(url=self.login_url, params=params, headers=self.headers)
if res.ok:
page_text = res.text
if re.search('/_guard/html.js\?js=slider_html',page_text):
raise ValueError('触发了滑动验证码,暂时无解') # TODO 滑动验证码
login_hash = re.findall('loginhash=(.*?)">', page_text, re.S)[0]
form_hash = re.findall('formhash" value="(.*?)".*? />', page_text, re.S)[0]
return login_hash, form_hash
Expand Down

0 comments on commit 8e0beba

Please sign in to comment.