-
Notifications
You must be signed in to change notification settings - Fork 14
/
analyze.txt
58 lines (43 loc) · 2.51 KB
/
analyze.txt
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
50
51
52
53
54
55
56
57
58
一、对于python
模仿ajax请求(header)
s=requests.Session()
s.headers.update({'X-Request': 'JSON', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'https://huaban.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36', 'Accept':'application/json'})
#### 以下针对画板
1. post
https://huaban.com/auth/
r1=s.post(url1, headers=headers)
data = dict(email="", password='')
headers["Content-type"] = "application/x-www-form-urlencoded; charset=UTF-8"
错误密码时返回(JSON): {"err":403,"msg":"用户密码错误"}
正确时返回(JSON):
{u'redirect': u'http://huaban.com/', u'user': {u'username': u'\u5c81\u6708\u5982\u5200\u65a9\u5929\u9a84', u'rating': 8191, u'user_id': 9880671, u'following_count': 43, u'roles': u'', u'location': u'\u5317\u4eac', u'status': {u'newbietask': 0, u'default_board': 13582018, u'past_shiji_guide': 1, u'featuretask': 6, u'share': u'0', u'lr': 1457690110, u'emailvalid': False, u'invites': 0}, u'boards_like_count': 15, u'like_count': 22, u'profile': {}, u'avatar': {u'farm': u'farm1', u'bucket': u'hbimg', u'height': u'700', u'width': u'541', u'key': u'18796173a3f91fcba4b767d0df743cdb041897ec73a4c-XlcHNT', u'frames': u'1', u'type': u'image/png', u'id': 131352797}, u'creations_count': 0, u'follower_count': 78, u'urlname': u'staugur', u'bindings': {u'weibo': u'weibo-3271188341'}, u'commodity_count': 0, u'pin_count': 1207, u'board_count': 2}}
2. get
https://huaban.com/boards/32956845/
r2=s.get(url2,headers=headers)
返回json['board': '']
3.ajax
max=data['board']['pins'][-1]['pin_id']
url3 = 'https://huaban.com/boards/32956845/?max=max&limit=100&wfl=1'
#Content-Type: application/json; charset=utf-8
r3=s.get(url3, headers=headers)
len(data3['board']['pins'])
100
data3['board']['pins'][0]['pin_id']
1131315846
data3['board']['pins'][-1]['pin_id']
973346258
######以下针对user
1. https://huaban.com/staugur
get 返回 json ['user']
board_count = data['board_count']
board_ids = [ board['board_id'] for board in data['boards'] ]
2. ajax
last_board_id=data['boards'][-1]['board_id']
https://huaban.com/staugur?jhhft3as&max=last_board_id&limit=10&wfl=1
get 返回 json ['user']
数据同1中
二、对于js
直接获取url中board_id,使用ajax访问首页及加载后续页即可获取所有json数据,拼接imgUrl通过不同下载方式保存图片即可。
三、堆糖网
利用ajax获取其接口数据,主要参数album_id,limit,start。