Created
December 16, 2014 23:13
-
-
Save thorsteneckel/2780e5cc75fe830d034a to your computer and use it in GitHub Desktop.
Extract video links from facebook.com via JS console of your browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page_content = document.documentElement.innerHTML; | |
var video_urls_encoded = /\"params\",\"[^\"]+(http.+\.mp4)/.exec(page_content); | |
var regex_unicode = /\\u([\d\w]{4})/gi; | |
var regex_unquote = /\\\//gi; | |
var match_counter = 1; | |
while ( match_counter < video_urls_encoded.length ) { | |
var current_url = video_urls_encoded[ match_counter ]; | |
current_url = current_url.replace(regex_unicode, function (match, grp) { | |
return String.fromCharCode(parseInt(grp, 16)); | |
} ); | |
current_url = decodeURIComponent(current_url); | |
current_url = current_url.replace( regex_unquote, '/'); | |
console.log( current_url ); | |
match_counter++; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment