Skip to content

Instantly share code, notes, and snippets.

@vivekseth
Last active August 29, 2015 14:05
Show Gist options
  • Save vivekseth/c8ec9966df4cdc9f71c3 to your computer and use it in GitHub Desktop.
Save vivekseth/c8ec9966df4cdc9f71c3 to your computer and use it in GitHub Desktop.
/**
Bookmarket to get movie url from einthusan.com website for download.
Note, this works because einthusan.com uses a simple HTTP GET request to retrieve movie file.
Simply download the URL in the popup using your browser or cURL.
*/
// Bookmarklet:
// javascript:(function()%7B%2F**Bookmarket%20to%20get%20movie%20url%20from%20einthusan.com%20website%20for%20download.Note%2C%20this%20works%20because%20einthusan.com%20uses%20a%20simple%20HTTP%20GET%20request%20to%20retrieve%20movie%20file.*%2Fvar%20getMovieURL%20%3D%20function()%20%7Bvar%20scriptElements%20%3D%20document.getElementsByTagName(%22script%22)%3Bfor%20(var%20i%3D0%3B%20i%3CscriptElements.length%3B%20i%2B%2B)%20%7Bvar%20tempScriptContent%20%3D%20scriptElements%5Bi%5D.textContent%3Bif%20(tempScriptContent)%20%7Bvar%20matches%20%3D%20tempScriptContent.match(%2Fhttp%3A%5C%2F%5C%2F%5Cd.*%3Fmovies_hindi.*%3F'%2F)%3Bif%20(matches)%20%7Bvar%20tempString%20%3D%20matches%5B0%5D%3Breturn%20tempString.substring(0%2C%20tempString.length-1)%3B%7D%7D%7Dreturn%20null%3B%7Dalert(getMovieUR%7D)()
// Source:
var getMovieURL = function() {
var scriptElements = document.getElementsByTagName("script");
for (var i=0; i<scriptElements.length; i++) {
var tempScriptContent = scriptElements[i].textContent;
if (tempScriptContent) {
var matches = tempScriptContent.match(/http:\/\/\d.*?movies_hindi.*?'/);
if (matches) {
var tempString = matches[0];
return tempString.substring(0, tempString.length-1);
}
}
}
return null;
}
alert(getMovieURL());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment