stopstalk-deployment icon indicating copy to clipboard operation
stopstalk-deployment copied to clipboard

Add support for LeetCode

Open wingkwong opened this issue 5 years ago • 14 comments

Please add submissions of LeetCode(problemset and contests) too. Thanks

wingkwong avatar Jul 24 '20 04:07 wingkwong

@wingkwong can I take up this issue?

PriyalsantoshJain avatar Aug 27 '20 07:08 PriyalsantoshJain

@PriyalsantoshJain I'm not the owner of this repo. Better wait for @raj454raj to endorse first.

wingkwong avatar Aug 27 '20 07:08 wingkwong

@wingkwong sure.

PriyalsantoshJain avatar Aug 27 '20 07:08 PriyalsantoshJain

Hey @PriyalsantoshJain you can take this up if Leetcode supports public submissions page or an API. Don't think this can be picked until then

raj454raj avatar Aug 27 '20 19:08 raj454raj

Hey, Is anyone working on this?

Rajan-226 avatar May 23 '21 08:05 Rajan-226

@raj454raj Please add the submissions of leetcode too. It will be indeed helpful.

ShriyasnhAgarwl avatar Mar 03 '22 05:03 ShriyasnhAgarwl

@raj454raj

Is public submissions page or an API below one - for example? https://leetcode.com/contest/weekly-contest-306/ranking If yes, yes, it has API to get all data for contests & users submissions using a script, can be seen easily via Chrome incognito mode.

FYI - @PriyalsantoshJain if you want to help implement

manoharreddyporeddy avatar Aug 19 '22 14:08 manoharreddyporeddy

URL :: https://leetcode.com/graphql

QUERY :: { matchedUser(username: "YOUR_USERNAME") { username submitStats: submitStatsGlobal { acSubmissionNum { difficulty count submissions } } } }

Sample Response :: { "data": { "matchedUser": { "username": "YOUR_USERNAME", "submitStats": { "acSubmissionNum": [ { "difficulty": "All", "count": 44, "submissions": 75 }, { "difficulty": "Easy", "count": 23, "submissions": 42 }, { "difficulty": "Medium", "count": 20, "submissions": 32 }, { "difficulty": "Hard", "count": 1, "submissions": 1 } ] } } } }

On Fri, Aug 19, 2022 at 7:57 PM Manohar Reddy Poreddy < @.***> wrote:

@raj454raj https://github.com/raj454raj

Is public submissions page or an API below one - for example? https://leetcode.com/contest/weekly-contest-306/ranking If yes, yes, it has API to get all data for contests & users submissions using a script, can be seen easily via Chrome incognito mode.

FYI - @PriyalsantoshJain https://github.com/PriyalsantoshJain if you want to help implement

— Reply to this email directly, view it on GitHub https://github.com/stopstalk/stopstalk-deployment/issues/415#issuecomment-1220744765, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANB5MY4SZ7IK6RZ2KQICZ73VZ6KVFANCNFSM4PGLII3A . You are receiving this because you commented.Message ID: @.***>

-- [image: Kind regards,]

SHRIYANSH AGARWAL Student , Lovely Professional University +91-7652093392 | www.lpu.in | @.*** @.***> Kanpur, UttarPradesh https://maps.google.com/?q=Kanpur,+UttarPradesh https://www.facebook.com/shriyanshagarwal.0502/ https://www.linkedin.com/in/shriyanshagarwal/

Create your own email signature https://www.wisestamp.com/create-own-email-signature/?utm_source=promotion&utm_medium=signature&utm_campaign=create_your_own&srcid=

ShriyasnhAgarwl avatar Aug 19 '22 15:08 ShriyasnhAgarwl

Also clist.by is already doing: https://clist.by/account/uwi/resource/leetcode.com/

manoharreddyporeddy avatar Aug 20 '22 16:08 manoharreddyporeddy

Hey @manoharreddyporeddy @ShriyasnhAgarwl

We need to get "ALL" the submissions given a handle of the user. If you're logged in to Leetcode, try opening this page - https://leetcode.com/submissions/#/1.

The same history is not available on a logged out state. Just getting the counts is not enough. Let me know if I am missing some API which gives this.

raj454raj avatar Aug 20 '22 17:08 raj454raj

Hey @raj454raj

1 Please clearly state ( bold/underline/etc ) what programming websites that stopstalk supports, at https://www.stopstalk.com/

===

Stay motivated by seeing your friends competitive programming progress. Add friends to see their submissions on various Competitive Programming websites (currently Codeforces, Codechef, Spoj, HackerEarth, HackerRank, UVa).

===

2 Many join to see https://leetcode.com/ but it does not support yet, and are disappointed after registering. The discussion here to submit the information on What We Know in an attempt to support leetcode.com, and somehow enable that platform too now or in future

manoharreddyporeddy avatar Aug 27 '22 03:08 manoharreddyporeddy

For a user ( example uwi , https://leetcode.com/uwi/ )

  1. API for public Recent Accepted Submissions are below
  2. Looks like the limit in the Payload, may be increased to a large value to get all Accepted values

===

https://leetcode.com/graphql/

Payload

{
    "query": "\n    query recentAcSubmissions($username: String!, $limit: Int!) {\n  recentAcSubmissionList(username: $username, limit: $limit) {\n    id\n    title\n    titleSlug\n    timestamp\n  }\n}\n    ",
    "variables": {
        "username": "uwi",
        "limit": 15
    }
}

Response

{
    "data": {
        "recentAcSubmissionList": [
            {
                "id": "779035448",
                "title": "Find the K-Sum of an Array",
                "titleSlug": "find-the-k-sum-of-an-array",
                "timestamp": "1661050111"
            },
            {
                "id": "779026429",
                "title": "Amount of Time for Binary Tree to Be Infected",
                "titleSlug": "amount-of-time-for-binary-tree-to-be-infected",
                "timestamp": "1661049650"
            },
            {
                "id": "779022476",
                "title": "Minimum Hours of Training to Win a Competition",
                "titleSlug": "minimum-hours-of-training-to-win-a-competition",
                "timestamp": "1661049401"
            },
            {
                "id": "779020545",
                "title": "Largest Palindromic Number",
                "titleSlug": "largest-palindromic-number",
                "timestamp": "1661049211"
            },
            {
                "id": "778573571",
                "title": "Maximum Segment Sum After Removals",
                "titleSlug": "maximum-segment-sum-after-removals",
                "timestamp": "1661006474"
            },
            {
                "id": "778567076",
                "title": "Shifting Letters II",
                "titleSlug": "shifting-letters-ii",
                "timestamp": "1661006197"
            },
            {
                "id": "778563405",
                "title": "Time Needed to Rearrange a Binary String",
                "titleSlug": "time-needed-to-rearrange-a-binary-string",
                "timestamp": "1661006035"
            },
            {
                "id": "778561125",
                "title": "Minimum Recolors to Get K Consecutive Black Blocks",
                "titleSlug": "minimum-recolors-to-get-k-consecutive-black-blocks",
                "timestamp": "1661005891"
            },
            {
                "id": "773048358",
                "title": "Count Special Integers",
                "titleSlug": "count-special-integers",
                "timestamp": "1660444794"
            },
            {
                "id": "773042460",
                "title": "Construct Smallest Number From DI String",
                "titleSlug": "construct-smallest-number-from-di-string",
                "timestamp": "1660444512"
            },
            {
                "id": "773040422",
                "title": "Node With Highest Edge Score",
                "titleSlug": "node-with-highest-edge-score",
                "timestamp": "1660444374"
            },
            {
                "id": "773039698",
                "title": "Largest Local Values in a Matrix",
                "titleSlug": "largest-local-values-in-a-matrix",
                "timestamp": "1660444285"
            },
            {
                "id": "766708840",
                "title": "Minimum Replacements to Sort the Array",
                "titleSlug": "minimum-replacements-to-sort-the-array",
                "timestamp": "1659797050"
            },
            {
                "id": "766698616",
                "title": "Merge Similar Items",
                "titleSlug": "merge-similar-items",
                "timestamp": "1659796613"
            },
            {
                "id": "766695309",
                "title": "Count Number of Bad Pairs",
                "titleSlug": "count-number-of-bad-pairs",
                "timestamp": "1659796486"
            }
        ]
    }
}

===

NOTE:

PROCEDURE to get above like information is below: . When on user page like https://leetcode.com/uwi/ . Press F12 (in chrome browser on Windows) . Now refresh the user page, & see "Network"

===

thanks for trying

@PriyalsantoshJain , @ShriyasnhAgarwl

manoharreddyporeddy avatar Aug 27 '22 03:08 manoharreddyporeddy

Hey @manoharreddyporeddy,

Thank you for your detailed inputs

API for public Recent Accepted Submissions are below

I did check this API. The problem with this is only "Accepted" submissions. Also the "limit" is capped at 20, try calling it with 30.

Stay motivated by seeing your friends competitive programming progress. Add friends to see their submissions on various Competitive Programming websites (currently Codeforces, Codechef, Spoj, HackerEarth, HackerRank, UVa).

Have updated this list now.

raj454raj avatar Aug 31 '22 12:08 raj454raj

Hey @raj454raj ,

A brother has created an API for many Competitive Programming Platforms including Leetcode. Using this API, we can check the total problem solved on LeetCode. Please check the links below. Hopefully, it will be useful for you.

Here is the Repository Link: https://github.com/Abhijeet-AR/Competitive_Programming_Score_API

Here is a link for LeetCode API: https://competitive-coding-api.herokuapp.com/api/leetcode/{user_name}

MusfiqDehan avatar Nov 10 '22 13:11 MusfiqDehan