[
  {
    "path": "Min/README.md",
    "content": "# CHDL\nCourse Hero File Downloader. Free.\n"
  },
  {
    "path": "Min/background.js",
    "content": "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()});"
  },
  {
    "path": "Min/manifest.json",
    "content": "{\n    \"name\": \"CHDL\",\n    \"description\": \"Don't tell your friendsgiving staff.\",\n    \"version\": \"1.0\",\n    \"permissions\": [\n        \"tabs\",\n        \"contextMenus\",\n        \"downloads\",\n        \"http://coursehero.com/*\",\n        \"https://coursehero.com/*\",\n        \"http://www.coursehero.com/*\",\n        \"https://www.coursehero.com/*\"\n    ],\n    \"background\": {\n        \"scripts\": [\"background.js\"],\n        \"persistent\": false\n    },\n    \"browser_action\": {\n        \"default_title\": \"Right click to see options.\"\n    },\n    \"icons\": {\n        \"48\": \"icon48.jpeg\"\n    },\n    \"manifest_version\": 2\n}\n"
  },
  {
    "path": "README.md",
    "content": "# CHDL\nCourse Hero File Downloader. Free.\n\n![](https://puu.sh/mnFsH/d2b9af6b23.png)\n\nThis script was hastily concocted. CHDL is a Chrome Extension that attempts to download full (unblurred) documents from Course Hero.\n\n## Installation\nThe extension must be installed in Chrome's developer mode.\n\n## Usage\nYou 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.\n\nThe extension works due to a weird permission error on CourseHero's end that fails to check what files users should be able to access.\n\nSingular file downloads seem to have a very high success rate when the entire document is shown (even if most pages are blurred).\n\nTry out the \"Download all files from this course.\" option to start downloading relevant files - it shouldn't be more than a handful. \n"
  }
]