-
Notifications
You must be signed in to change notification settings - Fork 76
/
pdd.py
49 lines (39 loc) · 1.22 KB
/
pdd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/local/bin/python3
import os
import math
import time
import random
import requests
from requests.utils import dict_from_cookiejar
def getRandomString(e):
e = 32 if not e else e
t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
r = ""
for i in range(e):
_ = math.floor(random.random()*len(t))
if _ < len(t):
r+= t[_]
return r
def getTimeStamp():
return int(round(time.time() * 1000))
session = requests.session()
anti_content = os.popen(f"node merge.js").read().strip()
url = "http://apiv3.yangkeduo.com/v4/operation/2715/groups"
group_params = dict(
offset = 0,
size = 100,
opt_type = 2,
sort_type = "DEFAULT",
list_id = f"2715_rec_list_catgoods_{getRandomString(6)}",
anti_content=str(anti_content),
pdduid=0
)
headers_get = {
'AccessToken': "",
'Content-Type': "application/x-www-form-urlencoded;charset=UTF-8",
'Origin': "http://yangkeduo.com",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36",
}
res = session.get(url, params=group_params, headers=headers_get)
with open("1.txt", "w", encoding="utf8") as f:
f.write(res.text)