Skip to content

Commit

Permalink
修复无法获取成长值的问题 (#78)
Browse files Browse the repository at this point in the history
* 修复无法获取成长值的问题

更改成长值获取接口

* 改用正则获取成长值
  • Loading branch information
Night-stars-1 authored Feb 8, 2023
1 parent 4cc8dea commit 6c3c31a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions miuitask.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -- coding:UTF-8 --
import requests
import re
import time
import json
import hashlib
import requests

from urllib import request
from http import cookiejar
Expand Down Expand Up @@ -358,12 +359,13 @@ def get_point(self) -> int:
'cookie': str(self.cookie)
}
params = {
'userId': str(self.uid),
'miui_vip_ph': str(self.miui_vip_ph)
}
try:
response = requests.get('https://api.vip.miui.com/mtop/planet/pc/post/userInfo', headers=headers,params=params)
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/member/getGrowUpPageData', headers=headers,params=params)
r_json = response.json()
your_point = r_json['entity']['userGrowLevelInfo']['point']
your_point = re.findall(r"'title': '成长值'.*'title': '(\d+)'.*'title': '/'", str(r_json['entity']))[0]
w_log('成功获取成长值,当前成长值:' + str(your_point))
return your_point
except Exception as e:
Expand Down

0 comments on commit 6c3c31a

Please sign in to comment.