Skip to content

Instantly share code, notes, and snippets.

@Oqarshi
Oqarshi / main.py
Last active November 28, 2023 01:03
stuff for chess.com api forum
import requests # pip install requests
import re # pip install re
from datetime import datetime
from colorama import Fore, Back, Style, init # pip install colorama
# colorama stuff
init(autoreset=True)
# for chess.com header
#------------------------ IMPORTANT------------------------ #
@Oqarshi
Oqarshi / main.py
Created November 27, 2023 23:33
gets user data from a chess.com game link
import requests
import re
from datetime import datetime
def extract_game_id(link):
# Use regular expression to extract the game ID from the link
match = re.search(r'/game/live/(\d+)', link)
if match:
return match.group(1)
else: