-
-
Save leftmove/a1c7d244b195f26b479904e0d7abb752 to your computer and use it in GitHub Desktop.
| let keepLooking = true | |
| XMLHttpRequest.prototype._originalOpen = XMLHttpRequest.prototype.open; | |
| XMLHttpRequest.prototype.open = function(method, url, async, user, password) { | |
| const isDelivery = url.includes("deliveries") | |
| const isM3u8 = url.includes("m3u8") | |
| if (keepLooking && isDelivery && isM3u8) { | |
| let videoUrl = url.replace("m3u8", "mp4") | |
| var videoIndex = videoUrl.indexOf("mp4") + 3 | |
| videoUrl = videoUrl.slice(0, videoIndex) | |
| console.log(videoUrl) | |
| keepLooking = false | |
| window.open(videoUrl, "_blank") | |
| this.open = this._originalOpen | |
| // window.location.reload() | |
| } | |
| this._originalOpen(method, url, async, user, password); | |
| } |
The console is basically the terminal that developers can use to debug and interact with the code of a website.
The code above looks for video URLs specifically for AP Classroom videos and opens a new tab of the source video.
To download any AP Classroom video:
- Open the video on AP Classroom
- Press CTRL + Shift + J to open the console or right click, press "Inspect," then click the console icon at the top
- Paste the code above (you probably have to type "allow pasting" to allow pasting) and press enter
- Make sure the video is playing
- It should have opened a new tab where you can right click and save video as a .mp4
If anyone else needs help setting this up — try consulting an AI chatbot like ChatGPT for help.
The response by @22poco is probably helpful to everyone reading, but if you face any other issues (like your browser not supporting Ctrl+Alt+J, or something context-specific), your best shot is to consult Google or some sort of AI chatbot. This will help you feed your personal circumstances (your browser, your OS, the amount of technical-knowhow you have etc.) into better troubleshooting.
It's also just more secure to double-check any code you don't understand. Running some stranger's code (even this stranger) always carries risk.
If your still facing problems, some other resources include StackOverflow or SuperUser. And although I am slow, you can always still comment here and I will get back to you as soon as I can.
Hello,
I’m not familiar with coding at all, and I saw your Reddit post mentioning copying code into the console. I’m a bit confused about how to do that—could you explain what the console is and how to access it?
I’m trying to link a few AP videos to my presentation, but they don’t seem to have direct URLs. They just play within the unit guide, so I’m not sure how to extract or share them properly.
Any help or guidance would be greatly appreciated!
Thank you,
L.