Monday, May 12, 2014

Download Pluralsight video content using Fiddler

Hi everyone, after years no blogging, no sharing to others people through internet, today I decide to start share any little things I know through my this ordinary blog. In this section I will try to share my experience about downloading pluralsight videos. I did it because I need to watch  offline those courses. I don't know is this activity is legal or not.

In order to able following this tutorial you need these things.
  • Visual Studio (any version)
  • Download and Install Fiddler 2 (Version: or any other version I think will works)
  • Active pluralsight subscription account.
Okay, after you ready with all above prerequisite items, lets begin. However before we write any codes, I will tell you about my understanding to what we will working on. Actually we will create an add-ons for Fiddler. Yes, we will create a super simple fiddler add-ons to download pluralsight videos content so we can watch those videos offline. If you curious about list of fiddler add-ons that now available, you can check it to here Okay lets start to write the codes:
  1. Create class library project in Visual Studio and targeted to .Net Framework 3.5
  2. Add project reference to Fiddler.exe, you can found fiddler.exe under directory that you choose when you installing fiddler, by default its located under C:\Program Files (x86)\Fiddler2\ directory.
  3. In your Visual Studio, more specific in  Solution Explorer, you will see Class1.cs, this file is automatically created by Visual Studio for you :). You can rename it to anything you want or you can delete it then create new one. In my case, I just rename the class name from Class1 to VideoDownloader.
  4. The important thing to remember when we create a Fiddler add-ons is that we must implement existing interfaces that Fiddler already provide. The interfaces that we must implement is IAutoTamper and IFiddlerExtension. For more familiar to any method that must be implement, you can try to debug by attach to process  and see what data that passed in to every methods. For example in the following screenshot I show you what value that passed to AutoTamperRequestBefore method. Actually you can make a complete this pluralsight videos downloader by only implement AutoTamperRequestBefore method. Put your download logic here, or you can create separate class and call download logic from there.
  5. Another thing we need to do is edit AssemblyInfo.cs file and add information about fiddler like the following screenshot.
  6. So far, we have finish create our super simple but awesome fiddler add-ons. Now you must compile the project and then put the .dll file from compilation to Fiddler Extension directory (C:\Program Files (x86)\Fiddler2\Scripts).
  7. Now you can test it by run fiddler and open browser. Here is my codes, if you want to see my logic for download pluralsight videos. There are so many hardcoded path and string, you need to modify to make it working on your local machine.