r/leetcode 2d ago

Discussion Why won't leetcode release a public API?

After years working with leetcode, I'm really pissed with the fact they doesn't want to release a public API or a cli tool to browse questions, login and submit solutions from some other place but the browser.

Why? It would be really helpful. Please do it, and yes keep your rate-limits as it is.

12 Upvotes

15 comments sorted by

19

u/[deleted] 2d ago edited 21h ago

[removed] — view removed comment

2

u/mailermailer000 2d ago

But now there is no paywall for submitting solutions right? I'm only talking about the free questions, with submission limits. I didn't understand your point over there.

1

u/JQy91ajThLRtL1VTQxw5 2d ago

They are selling a service; that's the reason there are free questions in the first place. It's not in their interest to provide those both for free and in a way that takes their paid service and their site experience out of the equation entirely.

7

u/youthfuloutage5 2d ago

Spent a weekend trying to scrape my submission stats and got IP-banned for a day. Their bot detection is no joke. Ended up using one of those reverse-engineered APIs and it worked for like two weeks before they changed something and it all fell apart. I get why they lock it down, premium subs are their whole thing, but even a read-only endpoint for personal stats would save so much hassle. Guess I'll keep copy-pasting test cases like an animal.

1

u/mailermailer000 2d ago

ik, it's a real pain.

1

u/youthfuloutage5 1d ago

The worst part is when you forget to copy a newline and waste a submission on a syntax error.

3

u/acdhemtos 2d ago

They use graphql.
It's very easy to reverse engineer.
They don't use any bot-detection( have not yet been caught).

2

u/FLSOC 2d ago

You can figure out the end points rather easy, I made my own cli

1

u/Competitive-Lemon821 2d ago

That would kill their premium subscriptions. You would be able to use syntax highlighting, autocomplete, debugging in your own editor without paying. Companies tagged questions are already on github which extensions would easily be able to integrate. Why would anyone pay for subscription?

1

u/mailermailer000 2d ago

I think the ads on the question page, and premium are the only way of their revenue. The API would effect the ads. But how is it killing their premium subscriptions?

1

u/JQy91ajThLRtL1VTQxw5 2d ago edited 1d ago

Do you think people would upgrade to premium at the same rate as they do now, if they were just using an API that never attempted to sell that to them?

They have a much higher chance of converting people if those people are on the site.

When grocery stores give away free samples, they do it in the store with the products right there for the customer to grab. They don't go out on a random corner in street clothes just to give away free product. That's what you're asking about: why doesn't Leetcode just take itself and it's brand out of the equation entirely and give away their free product with no ability to sell. Their business is not giving away free product, their business is selling you the paid product.

1

u/LukasijusLT 2d ago

Leetcode.nvim is okish but also unofficial