Funimation Sucks, youtube-dl to the Rescue

last modified August 3, 2020

funimation one piece homepage

Over quarantine I’ve found myself working with shows, radio, podcasts, and other content in the background frequently. It helps to ease the monotony of boring work and make the time go by a little faster. Long series with lots of episodes are perfect for this and so when I noticed One Piece, the massive 900+ episode anime saga had made it’s Netflix premiere, it felt like the perfect time to dive into this never-ending masterpiece.

One Piece is renowned for being an excellent piece of entertainment, but one so long as to be basically unapproachable and many fans actively encourage people not to get started with such a huge time commitment. That’s not an issue when the show is playing as background entertainment, but it does mean I need to watch the dubs version as reading subtitles and working don’t mix. Netflix was great for this, but they had only the first ~130 or so episodes (plus an awful crop) so after that, I was forced to go looking for another streaming site with dubs of all episodes. Funimation is that place, known for their excellent dubs and extensive catalog (I miss when they were a part of VRV) they had every dubbed One Piece episode for ($5.99 a month), but their web interface is awful and awful in every form (android app, android tv, desktop app, etc). I tolerated it for a while, but the crappy resizing, failure to skip to next episode, awful playback performance, and a multitude of another annoyances drove me to seek alternatives.

Eventually after much experimenting with extensions and other tools I settled on just ripping the damn videos with youtube-dl. I’m sure this breaks some sort of ToS, but who cares. Youtube-dl is an incredible script and set of tools that allows you to simply rip videos from dozens of sites with unbelivable customization available. There are tons of docs and tutorials available on how to install and use the tool so I won’t go deep into this, but the short version is (for windows since that’s my work computer) download youtube-dl and place it in a working folder. Now download ffmpeg, the incredible video cli tool and extract. Move everything from the bin folder (ffmpeg.exe, ffplay.exe, etc) to the same folder as youtube-dl. Open command prompt and navigate to the folder with youtube-dl (cd Downloads for example). There’s one more exe we need to grab and that is Atomic Parsley downloadable from here to help us merge metadata and other information (once again, extract and put the AtomicPrasley.exe file with all the others). That’s it, you’re installed and ready to rip.

Well almost, Funimation requires extra configuration. We need to download your cookie from the funimation site to log in and then access the videos to rip. This is easy with an extension like Export Cookies (you are using Firefox, right?) which can export cookies from a site to a .txt file with a click of a button. Go ahead and log into funimation and generate your cookie and save it in the same folder as all the .exe's we downloaded already.

The script

Starting the script is easy, just take the following, replace YOURUSERNAME with your Funimation username, YOURPASSWORD with your password, make sure the cookies-funimation-com.txt file is the same name as the cookie file you downloaded above and then change the final URL ()https://www.funimation.com/WHATEVER-SHOW-PAGE-HERE) to the page with the video you want to download (working as of August 2020).

youtube-dl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" -f best -u YOURUSERNAME -p YOURPASSWORD --cookies cookies-funimation-com.txt --embed-subs --embed-thumbnail --add-metadata -o %(episode_number)s-%(title)s.%(ext)s https://www.funimation.com/WHATEVER-SHOW-PAGE-HERE

To briefly break down what this is doing, --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" tricks funimation into thinking we’re a regular web browser (the script sometimes works without this, but it’s always a good idea to keep it just in case), -f best sets the format to the best version available, -u takes your username and -p your password, --cookies specifies the link to the cookie file, --embed-subs adds subs if they’re available (funimation sub extraction is currently broken, but there’s a patch to fix this and we’re waiting on the merge now), --embed-thumbnail adds a thumbnail, --add-metadata adds metadata with show description and other information, and -o defines the output format. If you don’t add those operators, you just get the episode name (and that is missing the number) which makes it difficult to tell what order everything should be watched in. The operators %(episode_number)s ensure that all file names begin with the episode number followed by the title (%(title)s) and then the proper extension (%(ext)s).

One further note: funimation has both English dubs and simulcast Japanese versions and you may want one or the other (or both). By default, the link will download the language set in your funimation preferences, but if you want to force the version then append /Uncut/?lang=English for English or /Simulcast/?lang=Japanese for Japanese at the end of the URL (and in place of ?qid= if that’s in URL).

running the script

running the script

the script churning away at an episode

The script should run looking something like above and eventually spit out your file in a nice and easily watchable format without having to mess with that horrible site. I went a step further and reencoded everything to x265 main10 to save space (taking a 1.4GB episode to 230MB with little discernable quality loss) using handbrake.

It should be noted, that you’ll likely have to generate a new cookie every hour or so or the command will fail and you’ll see an error message about JSON something. I’m not sure why this is the case as cookie duration should be longer, but it works so I haven’t dug into it. You’ll also need to update youtube-dl occasionally, but the command is a simple youtube-dl -U and everything is done for you.

The other big advantage of downloading these videos is now we can watch them in MPC-HC with MadVR which gives a significantly better image than the crappy web player, allows us to increase the framerate to 60fps, has much better colors and scaling (especially important on old SD anime’s like this one) and generally plays the video better than every other alternative.

Could I have pirated everything? Sure and maybe it’d be easier than doing this for each episode or setting up a batch, but there’s so many eps that even pirating it all at once sounds tedious and I don’t need hundreds of gigabytes of One Piece chilling on my storage. This works for now and when I have some more time I’d like to adapt tools like YoutubeDL Material to work with funimation so I can drop in a link, watch an episode, and clear the data without having to ever visit the cli.