A LeetCode webscraper to automate uploading questions into a Notion database for one's personal use, a finished template can be downloaded which feature questions from the LeetCode 75 list.
Extracts data from the LeetCode 75 list and posts it in a Notion database.
Here is a preview of the resulting database:
Click here for the Notion Database Template.
Site is currently in work in progress
-
Clone the repository:
git clone https://github.com/FishTomato/Leetcode-Webscraper
-
Install the required dependencies
npm install
-
Set up environment variables:
- Create a .env file in the root directory of the project.
- Add the following environment variables to the .env file:
PORT=3000 NOTION_KEY=<your_notion_api_key> NOTION_DATABASE_ID=<your_notion_database_id> NOTION_DIFFICULTY_ID=<your_notion_difficulty_column_id> NOTION_TOPICS_ID=<your_notion_topics_column_id> NOTION_NUMBER_ID=<your_notion_number_column_id> NOTION_URL_ID=<your_notion_url_column_id> NOTION_TITLE_ID=<your_notion_title_column_id>
-
Configure the project:
Review the scraper.js file and ensure the URL variable is set correctly. Customize the scraping logic in scraper.js as per your requirements. Some functions are properly tuned to scrape leetcode question data given the URL.
To run the program, use the following command:
node index.js