Repository: gregcw11/CHDL Branch: master Commit: 46cc3508f150 Files: 4 Total size: 3.0 KB Directory structure: gitextract_aggy6toa/ ├── Min/ │ ├── README.md │ ├── background.js │ └── manifest.json └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: Min/README.md ================================================ # CHDL Course Hero File Downloader. Free. ================================================ FILE: Min/background.js ================================================ function init(){chrome.tabs.executeScript({allFrames:!0,code:"document.documentElement.outerHTML"},function(a){parseHTML(a[0])})}function parseHTML(a){var b="document/",c="ratings/",d=a.indexOf(b),e=a.indexOf(c),f=a.substring(d+b.length,e-1);req(uUrl),req(fUrl+f),fLink=bUrl+fUrl+dUrl+f}function req(a){var b=new XMLHttpRequest;b.open("GET",bUrl+a,!0),b.onload=function(){if(b.status>=200||b.status<=400){var a=JSON.parse(b.responseText);console.log(a),manageData(a)}else console.log("Bad response from server.")},b.send()}function manageData(a){a.user_id?uInfo=a:a.db_filename?(fInfo=a,cID=fInfo.course_id,getAll?req(cUrl+cID+limit):download()):getAll&&(cInfo=a,download())}function download(){if(getAll){var a=bUrl+fUrl+dUrl;console.log("Trying cID"+cID);for(file in cInfo)console.log(file,a+cInfo[file].db_filename,cInfo[file].title),chrome.downloads.download({url:a+cInfo[file].db_filename})}else console.log(fLink,fInfo.title,fInfo.course.dept_acro,fInfo.course.course_num),chrome.downloads.download({url:fLink})}var bUrl="https://www.coursehero.com/api/v1/",uUrl="users/",fUrl="documents/",dUrl="download/",cUrl="documents/course/",fLink,uInfo,fInfo,cInfo,limit="/?limit=1000",getAll=!1;chrome.runtime.onInstalled.addListener(function(){chrome.contextMenus.create({title:"Download this file.",id:"getOne",contexts:["all"]}),chrome.contextMenus.create({title:"Download all files from this course.",id:"getAll",contexts:["all"]})}),chrome.contextMenus.onClicked.addListener(function(a,b){"getOne"===a.menuItemId?getAll=!1:"getAll"===a.menuItemId&&(getAll=!0),init()}); ================================================ FILE: Min/manifest.json ================================================ { "name": "CHDL", "description": "Don't tell your friendsgiving staff.", "version": "1.0", "permissions": [ "tabs", "contextMenus", "downloads", "http://coursehero.com/*", "https://coursehero.com/*", "http://www.coursehero.com/*", "https://www.coursehero.com/*" ], "background": { "scripts": ["background.js"], "persistent": false }, "browser_action": { "default_title": "Right click to see options." }, "icons": { "48": "icon48.jpeg" }, "manifest_version": 2 } ================================================ FILE: README.md ================================================ # CHDL Course Hero File Downloader. Free. ![](https://puu.sh/mnFsH/d2b9af6b23.png) This script was hastily concocted. CHDL is a Chrome Extension that attempts to download full (unblurred) documents from Course Hero. ## Installation The extension must be installed in Chrome's developer mode. ## Usage You must be on a document page on CourseHero to use the extension from either the toolbar or the right-click context menu, and you must be signed in on the CourseHero website. The extension works due to a weird permission error on CourseHero's end that fails to check what files users should be able to access. Singular file downloads seem to have a very high success rate when the entire document is shown (even if most pages are blurred). Try out the "Download all files from this course." option to start downloading relevant files - it shouldn't be more than a handful.