How to download all your freeCodeCamp solutions

How to download all your freeCodeCamp solutions
0

#1

The tool no longer works, due to a temporary security precaution on freeCodeCamp. It will be fixed once the precaution is removed.


Hi all - I just finished a rough draft of a command line tool that lets you download all your solutions into one .zip file.

From there you can push them up to their own GitHub repo or just gaze lovingly at them :slight_smile:

I haven’t tested the tool outside of Linux yet, so let me know if issues arise elsewhere.

Also, excuse the sloppy code - it’s a showerthought that became a rough idea…finesse will follow :slight_smile:

It performs a simple web scrape, but only GETs one http request, so makes no impact on the site more onerous than just looking at your profile page :wink:


Update

Cli tool has been made obsolete!

You can now use the tool in the browser using this simple web app version:

https://freecodecamp-solutions.herokuapp.com/


I can't access my previous code solutions under view solutions
Announcement: Viewing and sharing solutions from user profiles is temporarily disabled
Almost completed back-end cert
Streak won't update
Lost access to account
#2
Summary

to scrape: jacksonbates

you’re awesome Jack


#3

I spent a few hours doing that manually yesterday and now this easy feature is out. Nice!


#4

I regret only that I have but one :heart: to give.


#5

Verified on Windows 10 using cmd.

ETA: The README indicates that you need Git, but that’s just to get the repo. Anyone who wants to do this on a computer that doesn’t have Git (for whatever reason), you can skip the git clone step and just download and unzip.


#6

I am impressed with your shower prowess. At least in coming up with great ideas, lol.

I think I’ll fork and play around a bit with it, try and come up with a better solutions folder. Would you accept PR’s?


#7

Of course…

I do have plans to make it a web app that presents users with a simple form, they put their username in and then it just hands them their zip file. I know the terminal will be a bit intimidating for a lot of people. Express backend with an EJS landing page…nothing fancy.

The scraping logic would be the same, but I think there are nicer ways to create the zip file by streaming the files directly into an archive without having to create an intermediary tmp folder.

It might even be possible without a backend…still need to explore that :slight_smile:

But yes - PRs welcome!


#8

The words every programmer wants to hear! Thanks :slight_smile:


#9

My biggest problem with it right now is the amount of files and confusion in the output. Here is what my solutions folder looks like, and there is even more below what’s shown.

I think you should be able to see groupings of each project. Also, does it get clones/forks or just your own pens? Because I fork a lot of people’s pens when helping them, so that might be the problem. I think the Node app is a great idea! Maybe you could scrape the files, sort by project and let the user check which projects they want, and then tar and zip them and send file to user? I say that because I have a lot of crap project ideas I could care nothing about. Should be interesting.


#10

It doesn’t touch projects (pens etc), just solutions to challenges and algorithms.

Sorting them into html and js folders could help organise them a little better.

The current way they are collected is to get all the links on the profile page, only keep the ones that contain a solution (fcc stores all the solution text as a query string in the URL!), and then parses those, before zipping the output folder.

The URL query doesn’t say what section it comes from - we could hard code it in based on the structure of the curriculum…but that was far too annoying a job for me to do yesterday :slight_smile:


#11

I’m an idiot. For some reason I thought it downloaded your codepen projects. Anyway, this is a lot cooler!


#12

I figured projects already had a home somewhere - be that GitHub, Glitch or CodePen. I was inspired by the underage kid that got his account deleted - I figured it would be cool to have a quick way to download someone’s progress before wiping an account.

Also, the likes of @p1xt like to do speed runs after nuking their account! If you don’t have the confidence that you can solve all the problems again like she can, a back-up option seems like a must have :wink:


#13

Holy crap – this is awesome! I’ve been trying to save as I go, especially the tougher ones or really concise solutions I’m particularly proud of, but in one fell swoop I’ve got them all! Thanks!!!


#14

I really love this idea! You rock! I was taking screenshot after screenshot, now don’t have to do that. Yay! I’ll let you know if there are any issues on Win 10 or the latest Mac OS. Thanks again!


#15

Update

Cli tool has been made obsolete!

You can now use the tool in the browser using this simple web app version:

https://freecodecamp-solutions.herokuapp.com/


#16

I was just thinking about doing this manually when I stumbled across this. You just saved me quite a bit time. Very useful, thanks.


#17

Awesome! Hope it works well for you :slight_smile:


#18

@JacksonBates thank you for the awesome webapp.

I downloaded a solution today (for the first time). It is a json file where all the code is formatted in a single line, with “\n” used to represent new lines or returns.

What online tool do you recommend to re-format our solution into a prettier format? I’d love to have more readable code solutions.
Thanks.


#19

@simonhlee97 The tool I made has been broken since a security patch on the old curriculum site last year…it shouldn’t give you anything at all these days unless by some weird accident!

Could you paste your solution string here so I can take a look?


#20

{“index.jsx”:“class Counter extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n count: 0\n };\n // change code below this line\n this.decrement = this.decrement.bind(this);\n this.increment = this.increment.bind(this);\n this.reset = this.reset.bind(this);\n // change code above this line\n }\n // change code below this line\n increment() {\n this.setState({\n count: this.state.count + 1\n })\n }\n decrement() {\n this.setState({\n count: this.state.count - 1\n })\n }\n \n reset() {\n this.setState({\n count: 0\n })\n }\n // change code above this line\n render() {\n return (\n

\n Increment!\n Decrement!\n Reset\n

Current Count: {this.state.count}

\n
\n );\n }\n};”}