{"id":292,"date":"2008-12-03T15:45:00","date_gmt":"2008-12-03T15:45:00","guid":{"rendered":"http:\/\/blog.cyberwizzard.nl\/?p=292"},"modified":"2016-03-17T21:23:40","modified_gmt":"2016-03-17T20:23:40","slug":"download-videos-from-crunchyroll","status":"publish","type":"post","link":"https:\/\/blog.cyberwizzard.nl\/?p=292","title":{"rendered":"Download videos from Crunchyroll"},"content":{"rendered":"<p>With Dattebayo dropping Naruto Shippuden because CrunchyRoll will legaly release just hours after TV Tokyo airs, I decided it was time to write some magic to download the videos from Crunchroll. You see, I have a HTPC in my living room and I don\u2019t really fancy watching Naruto in a browser when the time comes.<\/p>\n<p>Disclaimer: this will NOT allow you to download paid shows without paying. Personal use only, don\u2019t be an **** and distribute the video.<\/p>\n<p><b>This will only work in FireFox \u2013 also, it will only work on the H264 videos<\/b>. Put the following code in a file and install it into <a href=\"https:\/\/addons.mozilla.org\/firefox\/addon\/748\" target=\"_blank\">GreaseMonkey<\/a>:<\/p>\n<p><i>crunchroll_video_download.js<\/i><\/p>\n<pre>\/\/ ==UserScript== \/\/ @name           Provide download link on Crunchroll videos \/\/ @namespace      http:\/\/www.crunchyroll.com\/ \/\/ @description    This script extracts the file name from the player code to allow the user to download it. \/\/ @include        http:\/\/www.crunchyroll.com\/media-*\/*.html?h264=1 \/\/ ==\/UserScript== \/\/ Get the div holding the player object var div = document.getElementById('showmedia_left_col_new'); \/\/ Grab the script in that div which constructs the player var script = div.getElementsByTagName('script')[0]; \/\/ Extract the configuration array from the script content var config_str = \/\"config\":\"([^\"]+)\"\/.exec(script.innerHTML); \/\/ Decode the URI encoding which is used on the config parameter, we now have some XML structure var html = decodeURI(config_str[1]); \/\/ Grab the file tag from the XML content var filename = unescape(\/<file>([^<]+)\/.exec(html)[1]);  \/\/ Find the message box on this page var msgbox = document.getElementById('message_box'); \/\/ Remove the style which hides it msgbox.setAttribute('style',''); \/\/ Get all divs inside the message box var divs = msgbox.getElementsByTagName('div'); \/\/ Set this to the div which should hold the message var msgdiv = null; \/\/ Loop through all found children to find the right one, with a class name 'message-list' for(i = 0; i < divs.length; i++) { \tif(divs[i].className == 'message-list') { \t\tmsgdiv = divs[i]; \t\tbreak; \t} }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With Dattebayo dropping Naruto Shippuden because CrunchyRoll will legaly release just hours after TV Tokyo airs, I decided it was time to write some magic to download the videos from Crunchroll. You see, I have a HTPC in my living room and I don\u2019t really fancy watching Naruto in a browser when the time comes. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[280,279,37,284,459,285,283,42,282,281,33],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-general-blog-entries","tag-crunchroll","tag-download","tag-from","tag-name","tag-not_ok","tag-provide","tag-rscript","tag-the","tag-userscript","tag-video","tag-videos"],"views":1579,"_links":{"self":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=292"}],"version-history":[{"count":1,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/292\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}