Skip to content

Instantly share code, notes, and snippets.

@Riebart
Last active Sep 1, 2021
Embed
What would you like to do?
Search through 3DMark results for all results for a specific GPU. Search result pagination is done by score.
#!/usr/bin/env python3
# GPU Search by string:
# "https://www.3dmark.com/proxycon/ajax/search/gpuname?term=" + s
import json
import requests
import time
import sys
gpu_ids = {
"GTX 1070": "1090",
"RTX 3080": "1338",
"RTX 3070": "1342",
"RTX 3090": "1339",
"RTX 2080 Ti": "1209",
"RX 6800": "1347",
"RX 6800 XT": "1348"
}
gpu_id = gpu_ids[sys.argv[1]]
max_score = 100000
searchUrl = f"https://www.3dmark.com/proxycon/ajax/newsearch?test=spy%20P&cpuId=&gpuId={gpu_id}&gpuCount=0&deviceType=ALL&memoryChannels=0&country=&scoreType=overallScore&hofMode=false&showInvalidResults=false&freeParams=&minGpuCoreClock=&maxGpuCoreClock=&minGpuMemClock=&maxGpuMemClock=&minCpuClock=&maxCpuClock="
while True:
try:
resp = requests.get(
searchUrl + f"&max={max_score}",
stream=False,
headers={
"Accept": "application/json, text/javascript, */*; q=0.01"
})
results = resp.json()
if "results" not in results or len(results["results"]) == 0:
break
next_max_score = min([r["overallScore"] for r in results["results"]])
# Avoid an infinite loop if everyone on a page has the exact same score.
if next_max_score == max_score:
next_max_score -= 1
print(max_score, next_max_score, file=sys.stderr)
print(json.dumps(results))
max_score = next_max_score
except Exception as e:
print("Encountered an error", e, file=sys.stderr)
time.sleep(5)
# time cat out.jsonl | jq -c '.results | map([.cpu, .url])[]' | grep -E "$(cat "Intel Mobile CPUs.csv" | tail -n+3 | tr ',' '\n' | grep -v "^$" | sed 's/$/ /' | paste -sd '|' | sed 's/^/(/;s/$/)/')" | jq -r '.[1]' | wget -qO- -i - | pup '.data text{}' | grep -vE "^[[:space:]]*$" | grep -EA1 "^(ID|Motherboard)[[:space:]]*$" | paste -sd ',' | sed -E 's/ID/\nID/g' | pv -l > out_mobile.csv
# cat rtx2080Ti_mobile.csv | grep -i alienware | cut -d',' -f2 | while read spyId; do echo -n "$spyId,"; ulId=$(wget -qO - "https://www.3dmark.com/spy/$spyId" | grep -o "/proxycon/ajax/bmrun/delete/3dm/[0-9]*" | cut -d '/' -f 7); echo -n "$ulId,"; wget -qO- "https://www.3dmark.com/proxycon/ajax/bmrun/secondarygpus/3dm/$ulId" | pup dd span text{} | paste -sd ','; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment