Spaces:
Running
Running
rogerxavier
commited on
Commit
•
91059aa
1
Parent(s):
4306672
Update utils.py
Browse files
utils.py
CHANGED
@@ -8,11 +8,12 @@ session = requests.Session()
|
|
8 |
urlBase = 'https://jingling.bifangpu.com'
|
9 |
purchaseBase = urlBase+"/api/resource/purchase"
|
10 |
|
11 |
-
#截止时间信息:jinglingpan:sessid=
|
12 |
-
cookie={"jinglingpan:sessid": "
|
13 |
|
14 |
|
15 |
session.cookies = requests.utils.cookiejar_from_dict(cookie)
|
|
|
16 |
headers = {
|
17 |
"authority": "jingling.bifangpu.com",
|
18 |
"method": "GET",
|
@@ -36,8 +37,7 @@ headers = {
|
|
36 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
#返回{"code": 10602}说明已经购买过
|
41 |
def try_puchase(fid:str,session)->dict:
|
42 |
payload = {
|
43 |
"fid": fid
|
@@ -45,6 +45,8 @@ def try_puchase(fid:str,session)->dict:
|
|
45 |
resp = session.post(purchaseBase, data=payload)
|
46 |
return resp.json()
|
47 |
|
|
|
|
|
48 |
#获取网盘信息函数,如果10602购买过,则刷新页面获取网盘信息,否则购买后刷新,反正都是调用一次try_purchase函数进行判断再刷新界面
|
49 |
#->list / None
|
50 |
def get_pan_info(fid:str,session):
|
@@ -80,5 +82,3 @@ if __name__ == '__main__':
|
|
80 |
|
81 |
panResult = get_pan_info(fid = fid,session=session)#每次先尝试购买然后重新打开detail页面查询返回
|
82 |
print(panResult)
|
83 |
-
|
84 |
-
|
|
|
8 |
urlBase = 'https://jingling.bifangpu.com'
|
9 |
purchaseBase = urlBase+"/api/resource/purchase"
|
10 |
|
11 |
+
#截止时间信息:jinglingpan:sessid=dea19e65-3658-4876-bbf4-41822a880f38; path=/; expires=Wed, 11 Sep 2024 02:28:24 GMT, jinglingpan:sessid.sig=XmwRzIWHfYpys2-KDOe2dg9eT1w; path=/; expires=Wed, 11 Sep 2024 02:28:24 GMT
|
12 |
+
cookie={"jinglingpan:sessid": "dea19e65-3658-4876-bbf4-41822a880f38", "jinglingpan:sessid.sig": "XmwRzIWHfYpys2-KDOe2dg9eT1w"}
|
13 |
|
14 |
|
15 |
session.cookies = requests.utils.cookiejar_from_dict(cookie)
|
16 |
+
|
17 |
headers = {
|
18 |
"authority": "jingling.bifangpu.com",
|
19 |
"method": "GET",
|
|
|
37 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
38 |
}
|
39 |
|
40 |
+
#返回{"code": 10602}说明已经购买过 #如果是1006说明当月已经超过限制,需要换号了
|
|
|
41 |
def try_puchase(fid:str,session)->dict:
|
42 |
payload = {
|
43 |
"fid": fid
|
|
|
45 |
resp = session.post(purchaseBase, data=payload)
|
46 |
return resp.json()
|
47 |
|
48 |
+
|
49 |
+
#如果是1006说明当月已经超过限制,需要换号了
|
50 |
#获取网盘信息函数,如果10602购买过,则刷新页面获取网盘信息,否则购买后刷新,反正都是调用一次try_purchase函数进行判断再刷新界面
|
51 |
#->list / None
|
52 |
def get_pan_info(fid:str,session):
|
|
|
82 |
|
83 |
panResult = get_pan_info(fid = fid,session=session)#每次先尝试购买然后重新打开detail页面查询返回
|
84 |
print(panResult)
|
|
|
|