When you export a Pen on CodePen, we give you all the code you've written, both processed and unprocessed. Generally, that's what you need, and will work locally just fine. But one thing we don't do is go fetch copies of every external resource you link up, like CSS files, JavaScript files, or images in your HTML.

You're of course free to go do that yourself, and drop the files into the project folder and change the URLs, making yourself an entirely offline-friendly of any Pen you export.

But what if you wanted to do all that programmatically?

Andrew Stuart wrote in with an idea to do just that. There is an open-source project called HTTrack that does exactly this. So Andrew wrote a Python script to use it with Embedded Pens:

He created a video walkthrough as well: