JacobLinCool / LeetCode-Stats-Card

Show your dynamically generated LeetCode stats on your GitHub profile or your website!
https://leetcard.jacoblin.cool
MIT License
663 stars 82 forks source link

Can't render when it comes to leetcode.cn #69

Closed CompetitiveLin closed 1 year ago

CompetitiveLin commented 2 years ago

![Leetcode Stats](https://leetcard.jacoblin.cool/CompetitiveLin?theme=light&ext=heatmap&site=cn) shows nothing.

Just like this below:

Leetcode Stats

But https://leetcard.jacoblin.cool/CompetitiveLin?theme=light&ext=heatmap&site=cn works.

How to fix it?

JacobLinCool commented 1 year ago

I believe that it is caused by the slow response from leetcode.cn, which makes GitHub image proxy timeout.

I'm not sure what's the threshold of the timeout, maybe around 3 or 4 seconds because it always needs about 4.5 seconds to show up without any cache. (I use chrome dev-tool to measure it.)

My suggestion is to use GitHub Actions as a cron job to generate it. You can use the package leetcode-card or simply use curl to download the SVG and commit it to the repository.

CompetitiveLin commented 1 year ago

I believe that it is caused by the slow response from leetcode.cn, which makes GitHub image proxy timeout.

I'm not sure what's the threshold of the timeout, maybe around 3 or 4 seconds because it always needs about 4.5 seconds to show up without any cache. (I use chrome dev-tool to measure it.)

My suggestion is to use GitHub Actions as a cron job to generate it. You can use the package leetcode-card or simply use curl to download the SVG and commit it to the repository.

You're using like a crawler to get those data and make a heatmap from leetcode.cn/graphql, are you?

JacobLinCool commented 1 year ago

You're using like a crawler to get those data and make a heatmap from leetcode.cn/graphql, are you?

Yes, the data are from the graphql endpoint.

You can find the details (of heat-map) at here.

Actually I'm not sure why LeetCode CN uses /graphql/noj-go/ instead of /graphql. (What does the "noj" means? N... Online Judge?)

CompetitiveLin commented 1 year ago

haha no idea

CompetitiveLin commented 1 year ago

BTW, it works now.