Created
June 1, 2022 09:37
-
-
Save nickfox-taterli/3d0e2d8b02c5f5b8f3682576964258fe to your computer and use it in GitHub Desktop.
新的speedtest欺骗
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import json | |
import requests | |
# 测速点ID,可以自己覆盖,默认选系统最优. | |
server_id = json.loads(requests.get('https://cli.speedtest.net/api/cli/config').text)['servers'][0]['id'] | |
# 下载速度(Mbps) | |
download_speed = 1000 | |
# 上传速度(Mbps) | |
upload_speed = 1000 | |
# 延迟(ms) | |
latency = 1.0 | |
payload = {'guid': str(uuid.uuid4()).upper(), 'download': {'client': {'speed': download_speed * 1000}}, | |
'upload': {'client': {'speed': upload_speed * 1000}}, 'latency': {'min': latency}, | |
'device': {'platform': 'cli'}, 'app': {'identifier': 'cli'}, 'config': {'server': {'id': server_id}}} | |
response = requests.post("https://results.speedtest.net/reports", headers={ | |
'Content-Type': 'application/json' | |
}, data=json.dumps(payload)) | |
print('Result URL:%s' % json.loads(response.text)['save']['shareUrl']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment