Skip to content

Instantly share code, notes, and snippets.

@mems
Created March 27, 2016 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mems/7e00ba82012d668d0164 to your computer and use it in GitHub Desktop.
Save mems/7e00ba82012d668d0164 to your computer and use it in GitHub Desktop.
Download all videos from http://www.appanimations.com/

First exec this in WebDev console for each page, copy in clipboard the iframes src of each videos + title + keywords

copy(JSON.stringify(Array.from(document.querySelectorAll("article")).map(article => [article.querySelector("iframe").src, /<a[^>]*>([^<]+)/.exec(article.querySelector("textarea").value)[1], article.querySelector(".cat").textContent])))

Go to https://videos.sproutvideo.com/embed/189bdbb01e1ce7c790/98b77e706be88310, open WebDev console and exec:

var videos = [
	/*PAST HERE the content of all pages*/
];
var output = "";
// Decode function using XOR with key `t`
function d(e, t) {
	var i, n, s, r, o, a, l, u;
	for (o = [], i = '', n = 0, u = s = 1; 255 >= s; u = s += 1) o[String.fromCharCode(u)] = u;
	for (l = r = 0, a = e.length - 1; a >= r; l = r += 1) i += String.fromCharCode(o[e.substr(l, 1)] ^ o[t.substr(n, 1)]),
	n = n < t.length ? n + 1 : 0;
	return i.replace(/[^\x20-\x7E]+/g, '')
}
var count = 0;
var total = videos.length;
for(let i = 0; i < total; i++){
	let video = videos[i];
	let xhr = new XMLHttpRequest();
	xhr.addEventListener("load", event => {
		let data = event.target.response.querySelector("script").textContent.slice(11, -2)
		let config = JSON.parse(atob(data));
		let url = d(unescape(config.hdvu), config.host);
		output += `		<file name="${video[1]}">
			<resources>
				<url type="http">${url}</url>
			</resources>
		</file>";
		
		if(++count >= total){
			copy(`<?xml version="1.0" encoding="UTF-8"?>
			<metalink version="3.0" xmlns="http://www.metalinker.org/">
				<files>
					${ouput}
				</files>
			</metalink>`);
			alert("You can now past clipboard content in a new file.")
		}
	})
	xhr.responseType = "document"
	xhr.open("GET", video[0])
	xhr.send()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment