|
@@ -26,8 +26,11 @@ def get_buff_data(page_num):
|
|
|
"Accept-Encoding": "gzip, deflate, br",
|
|
"Accept-Encoding": "gzip, deflate, br",
|
|
|
"Connection": "keep-alive"
|
|
"Connection": "keep-alive"
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- response = requests.get(url, headers=headers, params=querystring)
|
|
|
|
|
|
|
+ proxies={
|
|
|
|
|
+ "http": "http://USER660348-zone-custom-region-HK:e8b389:hk.rotgb.711proxy.com:10000",
|
|
|
|
|
+ "https": "http://USER660348-zone-custom-region-HK:e8b389:hk.rotgb.711proxy.com:10000",
|
|
|
|
|
+ }
|
|
|
|
|
+ response = requests.get(url, headers=headers, params=querystring, proxies = proxies)
|
|
|
return response.json()
|
|
return response.json()
|
|
|
|
|
|
|
|
def save_to_database(data):
|
|
def save_to_database(data):
|
|
@@ -122,19 +125,19 @@ def save_to_database(data):
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
|
ind = 0
|
|
ind = 0
|
|
|
- while ind < 400:
|
|
|
|
|
- ind = ind + 1
|
|
|
|
|
- # 获取Buff数据
|
|
|
|
|
- print("正在获取Buff数据,页码:" + str(ind))
|
|
|
|
|
- response_data = get_buff_data(ind)
|
|
|
|
|
-
|
|
|
|
|
- if response_data.get('code') == 'OK':
|
|
|
|
|
- # 保存到数据库
|
|
|
|
|
- save_to_database(response_data)
|
|
|
|
|
- else:
|
|
|
|
|
- print(f"API返回错误: {response_data.get('msg')}")
|
|
|
|
|
|
|
+ # while ind < 400:
|
|
|
|
|
+ ind = ind + 1
|
|
|
|
|
+ # 获取Buff数据
|
|
|
|
|
+ print("正在获取Buff数据,页码:" + str(ind))
|
|
|
|
|
+ response_data = get_buff_data(ind)
|
|
|
|
|
+
|
|
|
|
|
+ if response_data.get('code') == 'OK':
|
|
|
|
|
+ # 保存到数据库
|
|
|
|
|
+ save_to_database(response_data)
|
|
|
|
|
+ else:
|
|
|
|
|
+ print(f"API返回错误: {response_data.get('msg')}")
|
|
|
|
|
|
|
|
- time.sleep(5)
|
|
|
|
|
|
|
+ # time.sleep(5)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
main()
|
|
main()
|