Access LeetCode problems via id

Overview

LCid - access LeetCode problems via id

Introduction

As a world's leading online programming learning platform, LeetCode is quite popular among programmers. Since each problem has a unique number id, users tend to share problems via id. However, it is not convenient to visit problem page directly via id. People have to visit LeetCode Problems firstly, then enter that number id in the 'Search questions' input box, press 'enter', click the problem title link, finally comes to the problem page. What a hard work!

This simple project, called LCid, provides directly access to LeetCode problems via id. Features:

  • Fetch all LeetCode problems via crwaler.
  • Redirect to LeetCode problem page with problem id in the URL path via backend.
  • Support both LeetCode global site and China site redirect.
  • CI/CD, fetch all LeetCode problems daily and commit back to repository via Git Action, then trigger backend rebuild and redeploy with the latest problems via Heroku.

LCid is now available at lcid.cc. Just add / at the end of lcid.cc (e.g. lcid.cc/1), then browser will redirect you to the problem page. Simple, fast, and make your live easier.

What's more, to redirect to China site, add /cn/ instead (e.g. lcid.cc/cn/1). Interested in the brief info of the problem? Try /info/ (e.g. lcid.cc/info/1) and find more!

Environment

To start LCid on your local machine, you should have python 3.7+ installed.

The crawler is implemented with urllib3 and backend is powered with flask.

To install all those dependencies, execute pip install -r requirements.

Usage

Fetch All Problems

To fetch all problems, execute python fetch_problems_all.py. Then, you will see the logs below.

Now try get csrftoken...
Got csrftoken fakecsrftokenfakecsrftokenfakecsrftokenfakecsrftokenfakecsrftoke.
Found 2060 problems in total.
Now try fetch all 2060 LeetCode problems...
All 2060 problems fetched.
All 2060 problems info saved into problems_all.json file.

After few seconds, all problems info have been saved into problems_all.json file in json format.

Start Backend Service

To start backend service, execute python app.py (e.g. python app.py 1437). Then, the backend server will start at localhost: .

Now you can try the following endpoints. All of them should work correctly.

  • localhost: /
  • localhost: /1
  • localhost: /cn/1
  • localhost: /info/1

Deployment

To deploy the system for public access, of course, you can use any platform you like. Here, I use GitHub Actions and Heroku.

  • GitHub Actions is used to fetch all LeetCode problems daily (execute python fetch_problems_all.py, get the latest problems_all.json) and commit back to repository. You would know how it works by analysing this config file.
  • Heroku would rebuild and redeploy the backend service once main branch of this repository changed. This can be configured at Deploy - Automatic deploys in your Heroku app dashboard.
  • Heroku also support add additional domains to visit app. Here is the official guide.

Disclaimer

  • This is just a naive tool for convenient access and only call LeetCode API at low frequency. It only obtains public accessible data (no personal info or paid content collected and distributed). DO NOT ABUSE LEETCODE API!!!
  • GitHub Repo: bunnyxt/lcid
  • Author: bunnyxt
  • License: MIT
Owner
bunnyxt
Full Stack Developer, Student at University of Southern California
bunnyxt
Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker.

Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker. Unlimited RajeLiker Credit Hack. Thanks To RajeLiker.

Md. Mehedi Hasan 32 Dec 28, 2022
A part of HyRiver software stack for accessing hydrology data through web services

Package Description Status PyNHD Navigate and subset NHDPlus (MR and HR) using web services Py3DEP Access topographic data through National Map's 3DEP

Taher Chegini 51 Dec 10, 2022
A simple Telegram bot that converts a phone number to a direct whatsapp chat link

Open in WhatsApp I was using a great app to open a whatsapp chat with a given number directly without saving that number in my contact list, but I fel

Pathfinder 19 Dec 24, 2022
A Code that can make your Discord Account 24/7 on Voice Channels!

Voicecord Make your Discord Account Online 24/7 on Voice Channels! A Code written in Python that helps you to keep your account 24/7 on Voice Channels

Phantom 229 Jan 07, 2023
This is a simple bot for running Python code through Discord

Python Code Runner Discord Bot This is a simple bot for running Python code through Discord. It was originally developed for the Beginner.Codes Discor

beginner.py 1 Feb 14, 2022
OpenSea Python Bot coded purely in Python3.

OpenSea Python Bot coded purely in Python3. It utilises everything from OpenSea API to continuously monitor NFT's. It can be used to snipe or monitor if something falls below floor value.

OpenSea Elite Sniper 20 Dec 29, 2021
This repo contains a small project i've done using PILLOW module in python

This repo contains a small project i've done using PILLOW module in python. I wrote an automated script which generates more than 5k+ unique nfts with 0 hassle in less time.

SasiVatsal 11 Nov 05, 2022
Telegram group manager moderen and simple.

Upin Robot A Advanced Powerful, Smart And Intelligent Group Management Bot With New And Powerful Features ... Written with Pyrogram and Telethon... If

Muhammad Nawawi 3 Dec 23, 2021
Thread-safe Python RabbitMQ Client & Management library

AMQPStorm Thread-safe Python RabbitMQ Client & Management library. Introduction AMQPStorm is a library designed to be consistent, stable and thread-sa

Erik Olof Gunnar Andersson 167 Nov 20, 2022
Ein Bot, der Dokumente bei Studydrive möglichst immer online hält

studydrive-altklausuren-bot Ein Bot, der Dokumente bei Studydrive möglichst immer online hält geplante Features: Multiaccount supprt: Es gibt mehrere

henrydatei 1 Jun 04, 2022
Discord bot that automatically fills out health screenings

Auto Covid Bot Automatically fill out the NYC DOE health screening form by registering with a discord bot School code can be found on https://schoolse

Cleo 2 Jul 29, 2022
VoiceMaster-Discord-Bot - Fork from original Discord bot with max channel limit, staff role and more

VoiceMaster VoiceMaster is a discord bot created to change the way servers work,

2 Feb 28, 2022
Bitstamp API wrapper for Python

NOTICE: THIS REPOSITORY IS NO LONGER ACTIVELY MAINTAINED It is highly unlikely that I will respond to PRs and questions about usage. This library was

Jack Preston 53 Mar 09, 2022
A Discord token stealer app written in Python 3.

Discord Token Stealer A Discord token stealer app written in Python 3. This version of the grabber only supports Windows. Features No local caching Tr

cankat 45 Jan 03, 2023
just a program i made cuz a friend got tokenlogged and spammed me with these scam/phishing links so i made a programm to spam these websides with fake logins

scam-webside-spammer just a program i made cuz a friend got tokenlogged and spammed me with these scam/phishing links so i made a programm to spam the

TerrificTable 3 Sep 23, 2022
A tool to customize your discord tokens

Fastest Discord Token Manager - Features: Change Token Username Change Token Password Change Token Avatar Change Token Bio This tool is created by Ace

trey 15 Dec 27, 2022
A community made discord bot coded in Python and running on AWS.

Pogbot Project Open Group Discord This is an open source community ran project. Join the discord for more information on how to participate. Coded in

Project Open Group 2 Jul 27, 2022
A modular Telegram Python bot running on python3 with a sqlalchemy, redislab, mongo database, telethon, and pyrogram.

Zeldris Robot A modular Telegram Python bot running on python3 with a sqlalchemy, redislab, mongo database, telethon, and pyrogram. How to set up/depl

IDNCoderX 42 Dec 21, 2022
Easy and simple, Telegram Bot to Show alert when some edits a message in Group

Edit-Message-Alert Just a simple bot to show alert when someone edits a message sent by them, Just 17 Lines of Code These codes are for those who incu

Nuhman Pk 6 Dec 15, 2021
Python bindings to the Syncthing REST interface.

python-syncthing Python bindings to the Syncthing REST interface. Python API Documentation Syncthing Syncthing REST Documentation Syncthing Forums $ p

Blake VandeMerwe 64 Aug 13, 2022