-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve integration using Leetcode's GraphQL API #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A script like this shouldn't be too bad to write, but I'm wondering how you would go about making it a cron job with the website being frontend only. |
Good question! I think the easiest way is to leverage GitHub Actions - this blog post explains how we can introduce this capability: https://dev.to/anshuman_bhardwaj/free-cron-jobs-with-github-actions-31d6 More specifically, these files would be great as a starting point: https://github.com/Anshuman71/tweet-my-articles/tree/main/.github/workflows.
Edit: Ideally the script would generate all of src/data/index.js, and with a premium account, we might also be able to retrieve the "Companies" list updated for each question. |
Very cool, I'll check it out! I didn't know that GitHub let you to do things like this. Would the idea be to have the workflow make an automatic commit with the new index.js file (on a monthly basis or so)? |
Yeah I think that sounds right - let's start very small and introduce functionality one piece at a time. Here's what I was thinking - let me know if you see areas for improvement:
Again, this is a fairly large task and so if you (or anyone else who comes along gets stuck), please let me know! 🙌🏽 |
I opened a PR (for tracking progress) where I have step 1 currently completed. |
It looked great! I was browsing to see if the list of companies for each question is provided by GraphQL and good news - it is: For https://leetcode.com/problems/two-sum/:
Edit: I think we'll need to authenticate with Leetcode in order to view company-tagged details. |
In #177, it was brought to my attention that Leetcode has exposed their API via GraphQL. We should leverage this to automatically update question metadata, including difficulty and companies. Taking things even further, having a script to generate our question data via a cron job would be a dream!
The text was updated successfully, but these errors were encountered: