From 66352476cd1ff77b9f9867ca1753dc99114bed12 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 24 Nov 2025 13:37:24 +0000 Subject: [PATCH] 1 --- includes/scraper.php | 64 ++++++++++++ index.php | 225 +++++++++++++++---------------------------- profile.php | 163 +++++++++++++++++++++++++++++++ 3 files changed, 307 insertions(+), 145 deletions(-) create mode 100644 includes/scraper.php create mode 100644 profile.php diff --git a/includes/scraper.php b/includes/scraper.php new file mode 100644 index 0000000..4b2de6a --- /dev/null +++ b/includes/scraper.php @@ -0,0 +1,64 @@ + $handle]; + $data = ['query' => $query, 'variables' => $variables]; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', + 'Content-Length: ' . strlen(json_encode($data)) + ]); + + $result = curl_exec($ch); + $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + + if ($result === FALSE || $httpcode != 200) { + return ['error' => 'Failed to fetch data from LeetCode.']; + } + + $profileData = json_decode($result, true); + + if (isset($profileData['errors']) || !isset($profileData['data']['matchedUser']) || $profileData['data']['matchedUser'] === null) { + return ['error' => 'User not found or API error.']; + } + + return $profileData['data']['matchedUser']; +} +?> \ No newline at end of file diff --git a/index.php b/index.php index 7205f3d..5fd1d3c 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,85 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + CodeScore - Candidate Analytics + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- + + + +
+
+
+

Candidate Skill Analytics

+

Aggregate and analyze developer scores from top coding platforms to find the best talent, faster.

+
+
+ +
+
+
+
+
+
+

Find a Candidate Profile

+
+
+ +
+ + +
+
+
+ +
+
+
+ Support for other platforms coming soon! +
+
+
+
+
+
+
+
+ + + + - + \ No newline at end of file diff --git a/profile.php b/profile.php new file mode 100644 index 0000000..fd0019e --- /dev/null +++ b/profile.php @@ -0,0 +1,163 @@ + + + + + + + Profile: <?php echo $handle; ?> - CodeScore + + + + + + + + + +
+ +
+ Error: +

Please check the handle and try again. Note that the LeetCode API might be temporarily unavailable.

+
+ +
+ + User Avatar + +
+

+

@ on LeetCode

+
+
+ +
+
+
+
+
Contest Rating
+

+ Global Rank +
+
+
+
+
+
+
Problems Solved
+

+ +
+
+
+
+
+
+
Recent Activity
+

+ Accepted submissions in last 20 entries +
+
+
+
+ +
+
+
+
+

Recent Submissions

+
+
    + + +
  • + + + + +
  • + + +
  • No recent submissions found.
  • + +
+
+
+
+
+
+

Languages

+
+
+ $a['problemsSolved']; + }); + foreach ($profileData['languageProblemCount'] as $lang) { + echo '' + . htmlspecialchars($lang['languageName']) + . ' ' . $lang['problemsSolved'] . ''; + } + } else { + echo '

No language stats found.

'; + } + ?> +
+
+
+
+ +
+ + + + + +