leetcode-export
leetcode-export copied to clipboard
Solutions downloader
Could you allow also downloading of posted solutions, please?
It seems this could be done by POSTing to https://leetcode.com/graphql/ userSolutionTopics operation. The query is:
query userSolutionTopics($username: String!, $orderBy: TopicSortingOption, $skip: Int, $first: Int) {
userSolutionTopics(
username: $username
orderBy: $orderBy
skip: $skip
first: $first
) {
pageInfo {
hasNextPage
}
edges {
node {
id
title
url
viewCount
questionTitle
post {
creationDate
voteCount
}
}
}
}
}
The variables are like:
{
"username": "...",
"orderBy": "newest_to_oldest",
"skip": 0,
"first": 15
}
Thank you for sharing your suggestion! I had a quick look and found that exporting community solutions would be possible by using the userSolutionTopics graphql api you mentioned as well as the following to actually retrieve the solution:
query communitySolution($topicId: Int!) {
topic(id: $topicId) {
id
viewCount
topLevelCommentCount
subscribed
title
pinned
solutionTags {
name
slug
}
hideFromTrending
commentCount
isFavorite
post {
id
voteCount
voteStatus
content
updationDate
creationDate
status
isHidden
author {
isDiscussAdmin
isDiscussStaff
username
nameColor
activeBadge {
displayName
icon
}
profile {
userAvatar
reputation
}
isActive
}
authorIsModerator
isOwnPost
}
}
}
Right now, I don't have the bandwith to implement this, so I'll keep it unresolved for now. Contributions are welcome!