54 lines
2.0 KiB
Python
54 lines
2.0 KiB
Python
import subprocess, xml.etree.ElementTree as ET, time, sys
|
|
|
|
BGG_KEY = open('/tmp/.bggkey').read().strip()
|
|
HEADER = "Authorization: Bearer *** + BGG_KEY
|
|
|
|
# Wait for rate limit
|
|
time.sleep(10)
|
|
|
|
# Check all Valk results
|
|
url = 'https://boardgamegeek.com/xmlapi2/search?query=Valk&type=boardgame'
|
|
r = subprocess.run(['curl', '-s', '-H', HEADER, url], capture_output=True, text=True, timeout=30)
|
|
root = ET.fromstring(r.stdout)
|
|
items = root.findall('item')
|
|
print(f'Total Valk items: {len(items)}')
|
|
for item in items:
|
|
n = item.find('name')
|
|
name_val = n.get('value','') if n is not None else ''
|
|
item_id = item.get('id','')
|
|
if 'valkyo' in name_val.lower():
|
|
print(f' MATCH! id={item_id} name={name_val}')
|
|
elif 'valky' in name_val.lower():
|
|
print(f' PARTIAL: id={item_id} name={name_val}')
|
|
|
|
time.sleep(3)
|
|
|
|
# Check all Insanity results
|
|
url = 'https://boardgamegeek.com/xmlapi2/search?query=Insanity&type=boardgame'
|
|
r = subprocess.run(['curl', '-s', '-H', HEADER, url], capture_output=True, text=True, timeout=30)
|
|
root = ET.fromstring(r.stdout)
|
|
items = root.findall('item')
|
|
print(f'\nTotal Insanity items: {len(items)}')
|
|
for item in items:
|
|
n = item.find('name')
|
|
name_val = n.get('value','') if n is not None else ''
|
|
item_id = item.get('id','')
|
|
if 'insanità' in name_val.lower() or 's.p.a' in name_val.lower():
|
|
print(f' MATCH? id={item_id} name={name_val}')
|
|
elif 'insanit' in name_val.lower():
|
|
print(f' PARTIAL: id={item_id} name={name_val}')
|
|
|
|
time.sleep(3)
|
|
|
|
# Try INSANITA exact search again
|
|
url = 'https://boardgamegeek.com/xmlapi2/search?query=INSANIT%C3%80&type=boardgame&exact=1'
|
|
r = subprocess.run(['curl', '-s', '-H', HEADER, url], capture_output=True, text=True, timeout=30)
|
|
print(f'\nINSANITA exact search: {r.stdout[:500]}')
|
|
|
|
time.sleep(3)
|
|
|
|
# Try VALKYO exact search
|
|
url = 'https://boardgamegeek.com/xmlapi2/search?query=VALKYO&type=boardgame&exact=1'
|
|
r = subprocess.run(['curl', '-s', '-H', HEADER, url], capture_output=True, text=True, timeout=30)
|
|
print(f'\nVALKYO exact search: {r.stdout[:500]}')
|