As a group of friends who enjoy coding, we wanted to create a space where we can collaborate on LeetCode problems. We chose Discord because it is our primary form of communication, especially during quarantine, and it has a very user-friendly interface.

What it does

YeetCode Bot provides a way to find and display LeetCode problems on discord so you can work on them with your friends.

How we built it

Since LeetCode does not have an official API, YeetCode Bot uses web scraping to gather data about LeetCode problems and converts it into Discord formats. We used the Selenium library to parse a LeetCode problem and simulate a user’s clicks to access information.

Challenges we ran into

Beautiful Soup was a webscraping library, primarily used for scraping static webpages. Our main issue with Beautiful Soup was that we needed to extract dynamically generated elements, such as the table of questions. Therefore, we switched to Selenium which supports the extraction of dynamically generated web elements. Furthermore, since the official Discord API uses JavaScript, and selenium uses python, we had a lot of trouble getting our two scripts to communicate. Even though we could easily get JavaScript to run simple Python scripts, our more extensive webscraper script wouldn’t run.

Accomplishments that we're proud of

We are very proud of putting together a successful Discord bot that is connected to the webscraper we built. While the commands aren’t very extensive, we are happy with our progress with the past 2 days and for parsing through the LeetCode website without an official API.

What we learned

We learned how to build a webscraper using a pre-existing library and how to create a discord bot. We also figured out how to pass information to and from javascript and python programs.

What's next for YeetCode

We plan to continue building on YeetCode’s functionality and add more commands. Eventually we hope to add LeetCode authorization within our Discord bot so Discord users can login and solve LeetCode problems through Discord!

Share this project: