在爬虫测试中总是会遇到填写header的情况。
但是直接复制过来又不能直接使用,还要手动一个一个加冒号。加逗号。真的神烦。又找不到快速解决的在线工具。
现在分享大家一个快速解决的方法。
先举个栗子:
x-sgext: JAHWbz5dXEGpzq1WGKc8IW%2FnX%2BRW7kznWeFe4kzkVw%3D%3D
umid: JXYAnW1LPDTRQAJ7xO5re09CezrQjrEJ
x-sign: azU7Bc002xAAICmPCC94XzRhgNa4QCmAL1c6Bj4i0kg710mJ%2F1SaQ2SUKaeVzs83nXQOM4SIwpC6gu30eblt5IjEiBApsCmAKbApgC
x-nettype: WIFI
x-pv: 6.3
x-nq: WIFI
EagleEye-UserData: spm-cnt=a2170.7897990.0.0&spm-url=a2170.unknown.0.0
x-features: 27
x-app-conf-v: 0
x-mini-wua: HHnB_85fhQWriz98OFiVdjqaWd0lr4fIjwuSRrLgZm%2FXFycGWQgEFGcq41A3h%2BPFsYEJjQeBJ41StLOJmGXf0ZDOx5dQ%2BMsQMkMZcu8S5vz1ixfIb6ri5EflHubmDEwWqY2AOwbk%2FdWwl0Tsb5UCLaMz%2FLQ%3D%3D
content-type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 431
oaid: 798d057058de651f
x-t: 1631092723
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
x-bx-version: 6.5.19
f-refer: mtop
x-ttid: 1565839105065%40fleamarket_android_6.8.50
x-app-ver: 6.8.50
x-c-traceid: YThxbeejYlADAOpJ6zjqH6z816310927239490028116714
x-location: 113.575117%2C34.806005
x-umt: JXYAnW1LPDTRQAJ7xO5re09CezrQjrEJ
a-orange-q: appKey=21407387&appVersion=6.8.50&clientAppIndexVersion=1120210908130705771&clientVersionIndexVersion=0
x-utdid: YThxbeejYlADAOpJ6zjqH6z8
x-appkey: 21407387
x-devid: ArJi3zCkDjiaVvtlP3QecxPy4yVP-W4orytEOWcsY8p_
user-agent: MTOPSDK%2F3.1.1.7+%28Android%3B10%3BXiaomi%3BMi9+Pro+5G%29
Host: acs.m.taobao.com
Accept-Encoding: gzip
Connection: Keep-Alive
这是一个url的header头。
1、我们将他们粘贴到 sublime中,(我们只是为了使用它的正则。其他支持正则的都可以。)
2、然后CTRL + H 调用出替换界面。
3、第一栏,第二栏分别输入:
(.*?): (.*)$
?'$1':'$2',
4、点击replace all
注意事项:一定要选中这个正则按钮哦~
效果:
'x-sgext':'JAExncy6rqZbKV%2Bx6kDOxp0ArQOkCb4ArgCuA74FrQ%3D%3D',
'umid':'JXYAnW1LPDTRQAJ7xO5re09CezrQjrEJ',
'x-sign':'azU7Bc002xAALss8%2BnhoMRHusKw5vss%2BzenYuNycMPbZaas3Hep4%2FYYqyxl3cC2Jf8rsjWY2IC5YPA9KmwePWmp6aq7bHss%2Byx7LPs',
'x-nettype':'WIFI',
'x-pv':'6.3',
'x-nq':'WIFI',
'EagleEye-UserData':'spm-cnt=a2170.7897990.0.0&spm-url=a2170.unknown.0.0',
'x-features':'27',
'x-app-conf-v':'0',
'x-mini-wua':'HHnB_CUcDDtWaWt5hYjpxGNbwKKsKTNb24c3fxm%2FBe%2Fajv%2B99srAWIvZFLypKqL3bWoVKQThXZNwWsRbh3dVvIqGSBttXjKUrUJWTHNej7U2iKADJxA1mMXMsUGsNAQDOTAXX9GDOhFP9%2FV%2BbC4xEVGJV3g%3D%3D',
'content-type':'application/x-www-form-urlencoded;charset=UTF-8',
'Content-Length':'192',
'oaid':'798d057058de651f',
'x-t':'1631091184',
'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8',
'x-bx-version':'6.5.19',
'f-refer':'mtop',
'x-ttid':'1565839105065%40fleamarket_android_6.8.50',
'x-app-ver':'6.8.50',
'x-c-traceid':'YThxbeejYlADAOpJ6zjqH6z816310911845450040113132',
'x-location':'113.575104%2C34.805999',
'x-umt':'JXYAnW1LPDTRQAJ7xO5re09CezrQjrEJ',
'a-orange-q':'appKey=21407387&appVersion=6.8.50&clientAppIndexVersion=1120210908130705771&clientVersionIndexVersion=0',
'x-utdid':'YThxbeejYlADAOpJ6zjqH6z8',
'x-appkey':'21407387',
'x-devid':'ArJi3zCkDjiaVvtlP3QecxPy4yVP-W4orytEOWcsY8p_',
'user-agent':'MTOPSDK%2F3.1.1.7+%28Android%3B10%3BXiaomi%3BMi9+Pro+5G%29',
'Host':'acs.m.taobao.com',
'Accept-Encoding':'gzip',
'Connection':'Keep-Alive',
铛当当当,完工啦。是不是比手动一个一个搞快很多。
|