Untitled
unknown
plain_text
a year ago
502 B
11
Indexable
def get_fen():
"extract FEN out of from page"
time.sleep(3)
# html_source = chrome.page_source
response = requests.get(chrome.current_url)
html_source = response.content
root = html.fromstring(html_source)
scripts = root.xpath('//script/text()')
for script in scripts:
if 'lichess.startRound' in script:
split = script.split('fen')
fen = split[len(split) - 1].split('}')[0].split(':')[1]
fen = fen[1:-1]
return fenEditor is loading...
Leave a Comment