Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhengs committed Nov 20, 2021
1 parent 6fc9959 commit d6a2b02
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def encrypt(t):
"User-Agent": fake_ua, })

url = ''
for _ in range(3):
for _ in range(10):
try:
r = bjySession.get(url="https://m.bjyouth.net/site/login")
cap_url = "https://m.bjyouth.net" + re.findall(
Expand All @@ -64,6 +64,8 @@ def encrypt(t):
'Login[password]': login_password,
'Login[verifyCode]': cap_text
})
if login_r.text=='8':
print('Login: 验证码错误')
print(f'Login: [{login_r.status_code}]{login_r.text}')
r = json.loads(bjySession.get("https://m.bjyouth.net/dxx/index").text)
if 'newCourse' not in r:
Expand All @@ -82,7 +84,7 @@ def encrypt(t):
r2 = bjySession.get('https://m.bjyouth.net/dxx/my-integral?type=2&page=1&limit=15')
res = json.loads(r2.text)
if f"学习课程:《{title}》" in list(map(lambda x: x['text'], res['data'])):
print(f'{title} already finished')
print(f'{title} 在运行前已完成')
exit(0)

pattern = re.compile(r'https://h5.cyol.com/special/daxuexi/(\w+)/m.html\?t=1&z=201')
Expand All @@ -105,7 +107,7 @@ def encrypt(t):
r = bjySession.get('https://m.bjyouth.net/dxx/my-integral?type=2&page=1&limit=15')
res = json.loads(r.text)
if f"学习课程:《{title}》" in list(map(lambda x: x['text'], res['data'])):
print(f'{title} finished')
print(f'{title} 成功完成学习')
exit(0)
else:
print(f'Seem finished {title}, but not confirmed as {f"学习课程:《{title}》"}' not in {
Expand Down

0 comments on commit d6a2b02

Please sign in to comment.