Created
January 2, 2023 19:26
-
-
Save Opposite34/2bb75576654dbe7c993fe7f8ee336e3a to your computer and use it in GitHub Desktop.
Get all the name of the chess players with fide ratings above gothamchess (Levy Rozman)
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 requests | |
| #CHANGE THIS TO LEVY ROZMAN'S CURRENT RATING | |
| gotham_rating = 2322 | |
| headers = { | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0', | |
| 'Accept': '*/*', | |
| 'Accept-Language': 'en-US,en;q=0.5', | |
| # 'Accept-Encoding': 'gzip, deflate, br', | |
| 'X-Requested-With': 'XMLHttpRequest', | |
| 'DNT': '1', | |
| 'Connection': 'keep-alive', | |
| 'Referer': 'https://ratings.fide.com/', | |
| 'Sec-Fetch-Dest': 'empty', | |
| 'Sec-Fetch-Mode': 'cors', | |
| 'Sec-Fetch-Site': 'same-origin', | |
| } | |
| params = [ | |
| ('search', ''), | |
| ('search_rating', 'all'), | |
| ('search_country', 'all'), | |
| ('search_title', 'all'), | |
| ('search_other_title', 'all'), | |
| ('search_year', 'undefined'), | |
| ('search_low', f'{gotham_rating+1}'), | |
| ('search_high', '3500'), | |
| ('search_inactive', 'off'), | |
| ('search_exrated', 'off'), | |
| ('search_radio', 'rating'), | |
| ('search_bday_start', 'all'), | |
| ('search_bday_end', 'all'), | |
| ('search_radio', 'rating'), | |
| ('search_asc', 'descending'), | |
| ('search_gender', 'All'), | |
| ('simple', '0'), | |
| ] | |
| response = requests.get('https://ratings.fide.com/incl_search_l.php', params=params, headers=headers) | |
| #print(response.text) | |
| for line in response.text.splitlines(): | |
| if "Name" in line: | |
| with open("rating_above_gotham.txt", "a") as f: | |
| f.write(line.split("<")[2].split(">")[1]+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment