test
This commit is contained in:
@@ -0,0 +1 @@
|
||||
["https://api.chess.com/pub/player/carlosattack/games/2012/10", "https://api.chess.com/pub/player/carlosattack/games/2013/01", "https://api.chess.com/pub/player/carlosattack/games/2013/02", "https://api.chess.com/pub/player/carlosattack/games/2013/03", "https://api.chess.com/pub/player/carlosattack/games/2013/04", "https://api.chess.com/pub/player/carlosattack/games/2013/07", "https://api.chess.com/pub/player/carlosattack/games/2014/08", "https://api.chess.com/pub/player/carlosattack/games/2015/09", "https://api.chess.com/pub/player/carlosattack/games/2015/10", "https://api.chess.com/pub/player/carlosattack/games/2015/11", "https://api.chess.com/pub/player/carlosattack/games/2015/12", "https://api.chess.com/pub/player/carlosattack/games/2016/01", "https://api.chess.com/pub/player/carlosattack/games/2016/04", "https://api.chess.com/pub/player/carlosattack/games/2016/08", "https://api.chess.com/pub/player/carlosattack/games/2016/10", "https://api.chess.com/pub/player/carlosattack/games/2017/10", "https://api.chess.com/pub/player/carlosattack/games/2018/02", "https://api.chess.com/pub/player/carlosattack/games/2018/03", "https://api.chess.com/pub/player/carlosattack/games/2018/04", "https://api.chess.com/pub/player/carlosattack/games/2019/02", "https://api.chess.com/pub/player/carlosattack/games/2019/06", "https://api.chess.com/pub/player/carlosattack/games/2019/07", "https://api.chess.com/pub/player/carlosattack/games/2019/08", "https://api.chess.com/pub/player/carlosattack/games/2019/09", "https://api.chess.com/pub/player/carlosattack/games/2019/10", "https://api.chess.com/pub/player/carlosattack/games/2019/11", "https://api.chess.com/pub/player/carlosattack/games/2019/12", "https://api.chess.com/pub/player/carlosattack/games/2020/02", "https://api.chess.com/pub/player/carlosattack/games/2020/03", "https://api.chess.com/pub/player/carlosattack/games/2020/04", "https://api.chess.com/pub/player/carlosattack/games/2020/05", "https://api.chess.com/pub/player/carlosattack/games/2020/06", "https://api.chess.com/pub/player/carlosattack/games/2020/07", "https://api.chess.com/pub/player/carlosattack/games/2020/08", "https://api.chess.com/pub/player/carlosattack/games/2020/09", "https://api.chess.com/pub/player/carlosattack/games/2020/10", "https://api.chess.com/pub/player/carlosattack/games/2020/11", "https://api.chess.com/pub/player/carlosattack/games/2020/12", "https://api.chess.com/pub/player/carlosattack/games/2021/01", "https://api.chess.com/pub/player/carlosattack/games/2021/02", "https://api.chess.com/pub/player/carlosattack/games/2021/03", "https://api.chess.com/pub/player/carlosattack/games/2021/04", "https://api.chess.com/pub/player/carlosattack/games/2021/05", "https://api.chess.com/pub/player/carlosattack/games/2021/06", "https://api.chess.com/pub/player/carlosattack/games/2021/07", "https://api.chess.com/pub/player/carlosattack/games/2021/08", "https://api.chess.com/pub/player/carlosattack/games/2021/09", "https://api.chess.com/pub/player/carlosattack/games/2021/10", "https://api.chess.com/pub/player/carlosattack/games/2021/11", "https://api.chess.com/pub/player/carlosattack/games/2021/12", "https://api.chess.com/pub/player/carlosattack/games/2022/01", "https://api.chess.com/pub/player/carlosattack/games/2022/02", "https://api.chess.com/pub/player/carlosattack/games/2022/03", "https://api.chess.com/pub/player/carlosattack/games/2022/04", "https://api.chess.com/pub/player/carlosattack/games/2022/05", "https://api.chess.com/pub/player/carlosattack/games/2022/06", "https://api.chess.com/pub/player/carlosattack/games/2022/07", "https://api.chess.com/pub/player/carlosattack/games/2022/08", "https://api.chess.com/pub/player/carlosattack/games/2022/09", "https://api.chess.com/pub/player/carlosattack/games/2023/01", "https://api.chess.com/pub/player/carlosattack/games/2023/02", "https://api.chess.com/pub/player/carlosattack/games/2023/03", "https://api.chess.com/pub/player/carlosattack/games/2023/04", "https://api.chess.com/pub/player/carlosattack/games/2023/05", "https://api.chess.com/pub/player/carlosattack/games/2023/06", "https://api.chess.com/pub/player/carlosattack/games/2023/07"]
|
||||
@@ -0,0 +1 @@
|
||||
["https://api.chess.com/pub/player/hippodrunkimus/games/2023/03", "https://api.chess.com/pub/player/hippodrunkimus/games/2023/04", "https://api.chess.com/pub/player/hippodrunkimus/games/2023/05", "https://api.chess.com/pub/player/hippodrunkimus/games/2023/06", "https://api.chess.com/pub/player/hippodrunkimus/games/2023/07"]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+36698
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
|
||||
import requests
|
||||
username = "l6wwf0m49nxqkyz"
|
||||
password = "bdji5a8r2wt4zun"
|
||||
proxy = "rp.proxyscrape.com:6060"
|
||||
proxy_auth = "{}:{}@{}".format(username, password, proxy)
|
||||
proxies = {
|
||||
"http":"http://{}".format(proxy_auth)
|
||||
}
|
||||
urlToGet = "http://ip-api.com/json"
|
||||
r = requests.get(urlToGet , proxies=proxies)
|
||||
print("Response:\n{}".format(r.text))
|
||||
@@ -0,0 +1,91 @@
|
||||
// mainScript.js
|
||||
|
||||
import userAgents from './userAgents.js';
|
||||
|
||||
// Declare the script variable
|
||||
//
|
||||
let script;
|
||||
|
||||
window.downloadPGN = function() {
|
||||
const username = document.getElementById('usernameInput').value;
|
||||
|
||||
if (!username) {
|
||||
alert('Please enter a username.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a callback function to handle the JSONP response for archives
|
||||
const archivesCallback = 'handleArchivesResponse';
|
||||
window[archivesCallback] = function(data) {
|
||||
document.head.removeChild(script); // Remove the script element after execution
|
||||
threddGames(data); // Pass the list of archive URLs to the threaded function
|
||||
};
|
||||
|
||||
// Fetch player archives using JSONP
|
||||
playerArchives(username, archivesCallback);
|
||||
};
|
||||
|
||||
function getRandomUserAgent() {
|
||||
return userAgents[Math.floor(Math.random() * userAgents.length)];
|
||||
}
|
||||
|
||||
async function playerArchives(username, callback) {
|
||||
// Replace 'YOUR_API_KEY' with your Chess.com API key
|
||||
const url = `https://api.chess.com/pub/player/${username}/games/archives`;
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
window[callback](data.archives);
|
||||
}
|
||||
|
||||
async function playerMonthly(url, callback) {
|
||||
const user_agent = getRandomUserAgent();
|
||||
const headers = {
|
||||
'User-Agent': user_agent,
|
||||
};
|
||||
|
||||
const response = await fetch(url + '/pgn', { headers });
|
||||
const games = await response.text();
|
||||
window[callback](games); // Execute the callback function with the PGN data
|
||||
}
|
||||
|
||||
async function threddGames(archiveURLs) {
|
||||
const gamesList = [];
|
||||
|
||||
// Using Promise.all to wait for all threads to complete
|
||||
await Promise.all(archiveURLs.map(async (url) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const monthlyGamesCallback = 'handleMonthlyGamesResponse';
|
||||
window[monthlyGamesCallback] = function(data) {
|
||||
handleDownload(data, gamesList, resolve);
|
||||
};
|
||||
|
||||
// Fetch monthly games using JSONP
|
||||
await playerMonthly(url, monthlyGamesCallback);
|
||||
});
|
||||
}));
|
||||
|
||||
// Combine and save the games to a file
|
||||
const pgnDb = gamesList.join('\n\n');
|
||||
const username = document.getElementById('usernameInput').value;
|
||||
createDownloadLink(pgnDb, `${username}.pgn`);
|
||||
}
|
||||
|
||||
function handleDownload(data, gamesList, resolve) {
|
||||
gamesList.push(data);
|
||||
resolve(); // Resolve the promise to indicate completion of this thread
|
||||
}
|
||||
|
||||
function createDownloadLink(data, filename) {
|
||||
const blob = new Blob([data], { type: 'application/octet-stream' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
1. vscode-css-languageserver - cssls
|
||||
2. ccls - ccls
|
||||
3. dockerfile-language-server - dockerls
|
||||
4. erlang_ls-git - erlangls
|
||||
5. gopls - gopls
|
||||
7. vscode-json-languageserver - jsonls
|
||||
8. kotlin-language-server - kotlin_language_server
|
||||
9. sql-language-server - sqlls
|
||||
10. lua-language-server - sumneko_lua
|
||||
|
||||
11. marksman-bin - marksman
|
||||
13. typescript-language-server = tsserver
|
||||
14. nodejs-vls - vuels
|
||||
15. yaml-language-server - ymlls
|
||||
16. texlab - texlab
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Opponent Lookup Tool</title>
|
||||
</head>
|
||||
<body>
|
||||
<button id="startButton">Start Application</button>
|
||||
<div id="output"></div>
|
||||
<script src="your-script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
import user_agents
|
||||
import random
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
import json
|
||||
from concurrent import futures
|
||||
|
||||
|
||||
def player_archives(username):
|
||||
user_agent = random.choice(user_agents.user_agents)
|
||||
headers = {'User-Agent': user_agent}
|
||||
url = f"https://api.chess.com/pub/player/{username}/games/archives"
|
||||
response = requests.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
archive = response.json()['archives']
|
||||
|
||||
try:
|
||||
cwd = os.getcwd()
|
||||
path = os.path.join(cwd, 'archives')
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
file_name = os.path.join(path, username + '_archive.txt')
|
||||
with open(file_name, 'w') as f:
|
||||
json.dump(archive, f)
|
||||
|
||||
return archive
|
||||
|
||||
|
||||
def player_monthly(url=None):
|
||||
user_agent = random.choice(user_agents.user_agents)
|
||||
headers = {'User-Agent': user_agent}
|
||||
|
||||
if url:
|
||||
url += '/pgn'
|
||||
else:
|
||||
username = input("username: ")
|
||||
year = int(input("year in YYYY: "))
|
||||
month = int(input("month in MM: "))
|
||||
url = f"https://api.chess.com/pub/player/{username}/games/{year}/{month:02d}/pgn"
|
||||
|
||||
response = requests.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
content = response.content.decode('utf-8')
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def threaded_games(username=None, archive=None):
|
||||
if not archive:
|
||||
archive = player_archives(username or input("username: "))
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
results = executor.map(player_monthly, archive)
|
||||
|
||||
pgn_db = '\n\n'.join([r for r in results])
|
||||
with open(username + '.pgn', 'w') as f:
|
||||
return pgn_db
|
||||
@@ -0,0 +1,73 @@
|
||||
import user_agents # user_agents.py file with user_agents = [<user agent list>]
|
||||
import random
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
import json
|
||||
import concurrent.futures
|
||||
|
||||
|
||||
def playerArchives(username):
|
||||
# Create archive list. This is a list of pages containing lists of games used for futher downloading
|
||||
|
||||
user_agent = random.choice(user_agents.user_agents) # load up random user agent from list
|
||||
headers = {
|
||||
'User-Agent':user_agent
|
||||
}
|
||||
url = f"https://api.chess.com/pub/player/{username}/games/archives"
|
||||
archive = requests.get(url, headers=headers).json()['archives']
|
||||
|
||||
try:
|
||||
cwd = os.getcwd()
|
||||
path = os.path.join(cwd, 'archives')
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
file_name = os.path.join(path, username+'_archive.txt')
|
||||
with open(file_name, 'w') as f:
|
||||
json.dump(archive, f)
|
||||
|
||||
return archive
|
||||
|
||||
|
||||
def playerMonthly(url=None):
|
||||
|
||||
user_agent = random.choice(user_agents.user_agents) # load up random user agent from list
|
||||
headers = {
|
||||
'User-Agent':user_agent
|
||||
}
|
||||
|
||||
if url:
|
||||
url=url+'/pgn' # connect to multi-game pgn download endpoint by appending a "pgn" to the url provided by url in archive list
|
||||
else:
|
||||
username=input("username: ")
|
||||
YYYY=input("year in YYYY: ")
|
||||
MM=input("month in MM: ")
|
||||
url = f"https://api.chess.com/pub/player/{username}/games/{YYYY}/{MM}/pgn"
|
||||
|
||||
# get and save games list in .pgn format
|
||||
games = requests.get(url, headers=headers).content.decode("utf-8")
|
||||
|
||||
return games
|
||||
|
||||
# Multithreaded games download
|
||||
def threddGames(username=None, archive=None):
|
||||
|
||||
if archive:
|
||||
with open(archive) as f:
|
||||
archive = json.load(f)
|
||||
else:
|
||||
archive = playerArchives(username)
|
||||
|
||||
# async download games
|
||||
games_list = []
|
||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||
for future in executor.map(playerMonthly, archive):
|
||||
games_list.extend(future)
|
||||
pgn_db = "\n\n".join(games_list)
|
||||
with open(username+'.pgn', 'w') as f:
|
||||
f.write(pgn_db)
|
||||
|
||||
return pgn_db
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
user_agents = [
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35",
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35",
|
||||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35",
|
||||
"Mozilla/5.0 (Windows NT 6.1; rv:109.0) Gecko/20100101 Firefox/113.0",
|
||||
"Mozilla/5.0 (Android 12; Mobile; rv:109.0) Gecko/113.0 Firefox/113.0",
|
||||
"mozilla/5.0 (macintosh; intel mac os x 10.15; rv:109.0) gecko/20100101 firefox/113.0",
|
||||
]
|
||||
Reference in New Issue
Block a user