Skip to content

fix: resolve Cloudflare fetch issues and add daily challenge auto-scraping - #7

Open
l1ve709 wants to merge 4 commits into
chanpreet3000:masterfrom
l1ve709:fix-daily-challenge-scraper
Open

fix: resolve Cloudflare fetch issues and add daily challenge auto-scraping#7
l1ve709 wants to merge 4 commits into
chanpreet3000:masterfrom
l1ve709:fix-daily-challenge-scraper

Conversation

@l1ve709

@l1ve709 l1ve709 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Hey, this PR fixes a few bugs in the newly added Daily Challenge Solver (PR #6) so it can run completely hands-free.

Here is what's fixed:

  • Bypassed Cloudflare blocks: LeetCode started blocking raw Node.js fetch() requests to their GraphQL API (fetch failed / 403 errors). I moved the daily challenge fetch logic inside page.evaluate() so it uses the already authenticated Puppeteer browser. Works perfectly now.
  • Added Auto-Scrape: Before, if the user didn't already have the daily problem saved locally, the solver would just crash. Now, if the file is missing, it automatically tries to scrape your old submissions. If you haven't solved it before, it falls back to grabbing the official Editorial solution instead.
  • Fixed Language Aliases: Sometimes LeetCode returns python3 or golang but the user has python or go in their .env file, which caused the bot to skip the problem. Added a simple langAliases map to normalize these tags before checking.

Tested locally with npm start -> [3] and it successfully fetches and submits today's challenge without any manual intervention.

@l1ve709
l1ve709 force-pushed the fix-daily-challenge-scraper branch from 596316b to 3b585cb Compare August 19, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant