Skip to content
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

Update to support new LeetCode UI (regular problems) #464

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from

Conversation

Ahmed-Shukri02
Copy link

@Ahmed-Shukri02 Ahmed-Shukri02 commented Dec 27, 2022

LeetHub currently does not work with the new UI used by LeetCode. This is due to the fact that document queries no longer work now that classnames, ids and components are different. This is a fix to part of the problem and still needs developing, hence this being on the dev branch.

The only file I updated (other than a change in extension name for development in manifest.json) is leetcode.js. There are 2 new functions added as well as an update to loader() (not completed), parseQuestion() and parseStats():
RegExKeyMatch() // Line 442
parsePercentileNew() // Line 548
The function of these are explained in the code. Other than these files, nothing was updated and so the updates shown on the PR are a reflection of previous updates in main

The result of this is that LeetHub can now parse question details and submission statistics from both the old (left) and new (right) UI.

LeetHub

The formatting for the question description is different when using the new UI (text format compared to html), and so may need further formatting or a work-around.

This by no means completely fixes the issue but is what I'd call first steps in accommodating the new UI. I'm currently working on other functions such as getProblemNameSlug() and parseCode() to support this but first need to check if the current fixes are good or not.

@Ahmed-Shukri02
Copy link
Author

Ahmed-Shukri02 commented Dec 29, 2022

So I've worked more with leetcode.js and have managed to get LeetHub working for regular problems
With the new UI, LeetHub can now:

  • Parse question details, including: question name, question id, question difficulty and question description
  • Parse statistics of submission: Time (both abs and percentile) and Memory (both abs and percentile)
  • Get code submission
  • Upload README.md and respective code file to GitHub

leetcode-new-c

There are still many features to work on though, including

  • Get code submission for explore section
  • Get notes for regular problems

For now, however, this is a working fix to #366 #461

@Ahmed-Shukri02 Ahmed-Shukri02 changed the title Update to question description and question stats parsers to accommodate new LeetCode UI Update to support new LeetCode UI (regular problems) Dec 29, 2022
Copy link

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅✅

@QasimWani
Copy link
Owner

QasimWani commented Jan 5, 2023

awesome stuff @Ahmed-Shukri02. Could you perhaps also add the spinner? No worries if not, i can add that functionality.
regarding notes: i think it's better not to include them. most leetcode users don't use notes. This has been my experience after scanning hundreds of public LeetHub repos. let's leave it for now and make the common cast fast!

sozerodev added a commit to sozerodev/LeetHub that referenced this pull request Jan 6, 2023
@Ahmed-Shukri02
Copy link
Author

Ahmed-Shukri02 commented Jan 7, 2023

awesome stuff @Ahmed-Shukri02. Could you perhaps also add the spinner? No worries if not, i can add that functionality. regarding notes: i think it's better not to include them. most leetcode users don't use notes. This has been my experience after scanning hundreds of public LeetHub repos. let's leave it for now and make the common cast fast!

@QasimWani I've just added the spinner feature for the new UI:

LH1 (online-video-cutter com)

I've yet to work on the explore section though, and on some questions when I want to upload I get a 422 status code from github's API:

image

With the response message:

'Invalid request.\n\nFor 'properties/sha', nil is not a string.'

This is a question-consistent thing, not a random occurrence. It's also present on both versions of leetcode. What do you think may be the cause of this?

@Ahmed-Shukri02
Copy link
Author

Hi @QasimWani, can this update be merged into main since a lot of people are waiting for the new update?

@predict-woo
Copy link

@Ahmed-Shukri02 can you make a fork for people to use? The author doesn't seem to be responding to any pull requests.

@Ahmed-Shukri02
Copy link
Author

@Ahmed-Shukri02 can you make a fork for people to use? The author doesn't seem to be responding to any pull requests.

I have a public fork that you can use now. I've left instructions on using this on your local machine in this comment

@QasimWani
Copy link
Owner

Hey sorry guys. Will check this over the weekend and hopefully have it merged before Monday. Thanks for being patient with me!

@ibnsamy96
Copy link

ibnsamy96 commented Jan 25, 2023

Thanks @Ahmed-Shukri02 for your fantastic work on the extension. I really liked how you focused on adding support for the new design and I hope for your changes to be merged soon ^^

I found an issue to highlight, If I resubmit another solution to a previous problem, it isn't always pushed to the repo. It'll only be pushed if I refresh the page before the resubmission. And sometimes it shows the green check mark without pushing.
It's my first time using the extension so I don't know if it was happening with the old design too.
the issue gif

@codentacos
Copy link

Thanks @Ahmed-Shukri02 for your fantastic work on the extension. I really liked how you focused on adding support for the new design and I hope for your changes to be merged soon ^^

I found an issue to highlight, If I resubmit another solution to a previous problem, it isn't always pushed to the repo. It'll only be pushed if I refresh the page before the resubmission. And sometimes it shows the green check mark without pushing. And It's my first time using the extension so I don't know if it was happening with the old design too. the issue gif the issue gif

I feel like this could be a separate bug ticket. At least getting this PR merged would get the extension compatible with the new UI.

@Ahmed-Shukri02
Copy link
Author

I found an issue to highlight, If I resubmit another solution to a previous problem, it isn't always pushed to the repo. It'll only be pushed if I refresh the page before the resubmission. And sometimes it shows the green check mark without pushing. It's my first time using the extension so I don't know if it was happening with the old design too.

Thanks @ibnsamy96 for the good catch. Since in the new UI, you could switch tabs and revisit the accepted page, I didn't want LeetHub to upload to github multiple times, so I added a boolean that toggles on submission.

image

Once submitted, the boolean would cause LeetHub to stop checking for accepted submissions by exiting from the function early:

image

This was really just a quick fix and so meant that the script had to be reloaded for every submission. This could be considered as a bug or a feature I guess. Either way, I agree with @codentacos that we should try and get this merged as soon as possible then maybe file an issue

@codentacos
Copy link

Any update's about when this can get merged? @QasimWani

@yuletide
Copy link

Any updates? Would be nice to have this working again.

@officialpiyush
Copy link

any updates on this?

it was my first time using the extension, and after linking I was looking for the upload button, but couldn't figure out how to. when I checked the issues, then I realized that it is an issue because of LeetHub's UI change 😣

@Rehmankk360
Copy link

Rehmankk360 commented Feb 16, 2023

@QasimWani Please Merge this , Its fixed in this PR , I checked

@alexeyantropov
Copy link

@QasimWani, could you merge it?

@codentacos
Copy link

I feel like this repo needs an additional maintainer who can merge PR's

@userAugustos
Copy link

userAugustos commented Feb 24, 2023

Another 2 issues open, that are related to this PR.
Maybe an additional maintainer is really necessary, btw i have teste by local, as Ahmed suggest in this issue and it's working as well.

#503 this error, and the 3 before, would be solved by this PR

@yuletide
Copy link

yuletide commented Feb 27, 2023

Not a good sign 😅 https://twitter.com/qasim31wani/status/1617170664271613955?s=20

We just need this merged, another maintainer seems like a great idea if Qasim is open to it

@codentacos
Copy link

Not a good sign 😅 twitter.com/qasim31wani/status/1617170664271613955?s=20

We just need this merged, another maintainer seems like a great idea if Qasim is open to it

I have seen before when a project is no longer maintained someone fork's it and maintains a new version of it. Something along those lines. Although if he needs motivation he could charge $1 a month for licenses to use it then he gets $30K MRR. Would that be motivation enough? 👀

@yuletide
Copy link

@codentacos yes I think a fork is a good idea, if he is not able to maintain or willing to add access for others. It's too bad.

@QasimWani
Copy link
Owner

hey guys. sorry just saw this. Am talking to few OG LeetHub developers to take most of the responsibility of my shoulders. should have an update the next few days!

@userAugustos userAugustos mentioned this pull request Mar 1, 2023
@thegarvitrai
Copy link

Hey @QasimWani. Let us know if you're looking for any help, we all can give a hand

@ibnsamy96
Copy link

I hope to update the manifest file to v3 before merging
manifest file screenshot

@zerone0x
Copy link

Have it fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.