五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

星星充電 充電樁數(shù)據(jù)爬蟲

2023-02-23 00:59 作者:拉燈的小手  | 我要投稿

本文所有教程及源碼、軟件僅為技術研究。不涉及計算機信息系統(tǒng)功能的刪除、修改、增加、干擾,更不會影響計算機信息系統(tǒng)的正常運行。不得將代碼用于非法用途,如侵立刪!

某星充電APP 充電樁信息

環(huán)境

  • win10

  • 某星充電 APP 7.9.0版本

  • Android8.1

X-Ca-Signature參數(shù)分析

APP有防抓包檢測,使用算法助手啟動可正常抓包,分析數(shù)據(jù)包后發(fā)現(xiàn)關鍵的就是X-Ca-Timestamp和X-Ca-Signature, Timestamp很明顯看出來是時間戳,重點分析一下Signature參數(shù)

在這里插入圖片描述

脫殼后搜索關鍵詞:X-Ca-Signature 只有一處跟進去分析一下具體的參數(shù)構造

在這里插入圖片描述


在這里插入圖片描述

可以很明顯看到是參數(shù)加上固定的key拼接后做了md5處理

在這里插入圖片描述

Signature參數(shù)分析

站點詳情有一個Signature參數(shù)是H5加載js生成的,定位到具體賦值的位置,然后往上跟可以看到是經過一個隨機uid+時間戳生成的

在這里插入圖片描述

? ?def get_signtrue(self, dic: dict):
? ? ? ?"""
? ? ? ?生成signature參數(shù):7.9.0版本
? ? ? ?"""
? ? ? ?if (not "userId" in dic):
? ? ? ? ? ?dic["userId"] = ""
? ? ? ?new_list = []
? ? ? ?for i in self.run_sort(dic.keys()):
? ? ? ? ? ?new_list.append(f"{i}={dic[i]}")
? ? ? ?return self.get_md5("&".join(new_list))

獲取指定城市所有站點數(shù)據(jù)

? ?def get_SearchStation(self, k, v):
? ? ? ?"""
? ? ? ?獲取指定城市所有站點數(shù)據(jù)
? ? ? ?"""
? ? ? ?# 提取城市經緯度
? ? ? ?center = v['districts'][0]['center']
? ? ? ?lng = center.split(',')[0] ?# 經度
? ? ? ?lat = center.split(',')[1] ?# 維度
? ? ? ?CityCode = v['districts'][0]['adcode'] ?# 城市代碼
? ? ? ?_time = self.get_time() ?# 時間戳
? ? ? ?page = 1
? ? ? ?while True:
? ? ? ? ? ?data = {
? ? ? ? ? ? ? ?"stubGroupTypes": "0",
? ? ? ? ? ? ? ?"currentLat": lat, ?# 當前坐標經度
? ? ? ? ? ? ? ?"orderType": "1",
? ? ? ? ? ? ? ?"orCityCode": CityCode, ?# 城市代碼
? ? ? ? ? ? ? ?"lng": lng, ?# 城市坐標維度
? ? ? ? ? ? ? ?"pagecount": "50",
? ? ? ? ? ? ? ?"currentLng": lng, ?# 當前坐標維度
? ? ? ? ? ? ? ?"page": page,
? ? ? ? ? ? ? ?"radius": "10000",
? ? ? ? ? ? ? ?"lat": lat, ?# 城市坐標經度
? ? ? ? ? ? ? ?"showPromoteLabel": "1"
? ? ? ? ? ?}
? ? ? ? ? ?X_Ca_Signature = self.get_X_Ca_Signature(data, _time)
? ? ? ? ? ?headers = {
? ? ? ? ? ? ? ?'appVersion': '7.9.1.1',
? ? ? ? ? ? ? ?'X-Ca-Timestamp': _time,
? ? ? ? ? ? ? ?'X-Ca-Signature': X_Ca_Signature,
? ? ? ? ? ? ? ?'Connection': 'Keep-Alive',
? ? ? ? ? ? ? ?'User-Agent': 'okhttp/3.12.1',
? ? ? ? ? ?}
? ? ? ? ? ?# res = requests.post(url=url, data=data, headers=headers, proxies=self.proxies, verify=True, allow_redirects=True, timeout=60)
? ? ? ? ? ?res = self._parse_url(url=url, data=data, headers=headers)
? ? ? ? ? ?# print(res.text)
? ? ? ? ? ?if not res.text or res.status_code != 200:
? ? ? ? ? ? ? ?logger.info(f'{k} 第{page}頁數(shù)據(jù)獲取失敗')
? ? ? ? ? ? ? ?return
? ? ? ? ? ?if not res.json().get('data'):
? ? ? ? ? ? ? ?logger.info(f'{k} 數(shù)據(jù)獲取完成')
? ? ? ? ? ? ? ?return

? ? ? ? ? ?new_path = '數(shù)據(jù)' + os.sep + k
? ? ? ? ? ?if not os.path.exists(new_path):
? ? ? ? ? ? ? ?os.makedirs(new_path)
? ? ? ? ? ?filename = new_path + os.sep + '站點列表.json'
? ? ? ? ? ?# 多頁的情況直接把新數(shù)據(jù)添加至已有文件
? ? ? ? ? ?if os.path.exists(filename):
? ? ? ? ? ? ? ?with open(filename, 'r+', encoding='utf-8') as f:
? ? ? ? ? ? ? ? ? ?row_data = json.load(f)
? ? ? ? ? ? ? ? ? ?row_data['data'] += res.json().get('data')
? ? ? ? ? ? ? ? ? ?with open(filename, 'w', encoding='utf-8') as f1:
? ? ? ? ? ? ? ? ? ? ? ?json.dump(row_data, f1, ensure_ascii=False)
? ? ? ? ? ?else:
? ? ? ? ? ? ? ?with open(filename, 'w', encoding='utf-8') as f:
? ? ? ? ? ? ? ? ? ?# ensure_ascii 不適用ascii編碼 解決不能顯示中文問題
? ? ? ? ? ? ? ? ? ?json.dump(res.json(), f, ensure_ascii=False)

? ? ? ? ? ?logger.info(f'{k} 第{page}頁數(shù)據(jù)獲取成功')
? ? ? ? ? ?page += 1

獲取站點詳情信息

? ? ? ?def get_detail(self, stationId, name, lat, lng):
? ? ? ?"""
? ? ? ?獲取站點詳情
? ? ? ?"""
? ? ? ?_time = self.get_time() ?# 時間戳
? ? ? ?nonce = self.get_nonce() ?# nonce參數(shù)
? ? ? ?test_ = {
? ? ? ? ? ?"id": stationId,
? ? ? ? ? ?"gisType": "1",
? ? ? ? ? ?"lat": lat,
? ? ? ? ? ?"lng": lng,
? ? ? ? ? ?"stubType": "0",
? ? ? ? ? ?"versionFlag": "1",
? ? ? ? ? ?"nonce": nonce,
? ? ? ? ? ?"timestamp": _time
? ? ? ?}
? ? ? ?get_signtrue = self.get_signtrue(test_)
? ? ? ?headers = {
? ? ? ? ? ?"referrer": "web",
? ? ? ? ? ?"Accept": "application/json, text/plain, */*",
? ? ? ? ? ?"timestamp": _time,
? ? ? ? ? ?"signature": get_signtrue,
? ? ? ? ? ?"User-Agent": "Mozilla/5.0 (Linux; Android 8.1.0; Nexus 5X Build/OPM7.181205.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.98 Mobile Safari/537.36",
? ? ? ? ? ?"appVersion": "7.9.0",
? ? ? ? ? ?"Accept-Language": "zh-CN,en-CA;q=0.8,en-US;q=0.6",
? ? ? ?}
? ? ? ?params = {
? ? ? ? ? ?"id": stationId,
? ? ? ? ? ?"gisType": "1",
? ? ? ? ? ?"lat": lat,
? ? ? ? ? ?"lng": lng,
? ? ? ? ? ?"stubType": "0",
? ? ? ? ? ?"versionFlag": "1",
? ? ? ? ? ?"nonce": nonce,
? ? ? ?}
? ? ? ?response = requests.get(url, headers=headers, params=params)
? ? ? ?print(response.text)
? ? ? ?if not response.text or response.status_code != 200:
? ? ? ? ? ?logger.info(f'{name} 數(shù)據(jù)獲取失敗')
? ? ? ? ? ?return

? ? ? ?if not response.json().get('data'):
? ? ? ? ? ?logger.info(f'{name} 數(shù)據(jù)獲取完成')
? ? ? ? ? ?return
? ? ? ?return response.json()

效果

請?zhí)砑訄D片描述

資源下載

https://download.csdn.net/download/qq_38154948/87484473

本文僅供學習交流使用,如侵立刪!


星星充電 充電樁數(shù)據(jù)爬蟲的評論 (共 條)

分享到微博請遵守國家法律
治县。| 安化县| 宽城| 新竹市| 瓦房店市| 新田县| 五华县| 新宾| 双城市| 宝山区| 八宿县| 潜山县| 女性| 南郑县| 五台县| 筠连县| 大理市| 青龙| 西平县| 曲靖市| 枣强县| 五台县| 临城县| 赤水市| 土默特右旗| 西宁市| 石首市| 泰宁县| 龙口市| 诸城市| 阆中市| 阿图什市| 牙克石市| 哈尔滨市| 泗阳县| 北辰区| 新竹县| 淮滨县| 海城市| 房山区| 西宁市|