How to Download Facebook Look back Video? - facebook

What should Do, If I want to download Facebook Lookback Video

Reference
Simple JS Script to get Video URL from Facebook's Look Back
Copy paste this whole code into Chrome Console and press enter.
You can execure this script on any page on Facebook.
It will give you the video URL, open it, view it, download it, do whatever you want to. :P
The video URL will popup in front of you, press Ctrl + C to copy it.
To do so, open Chrome Console, Ctrl + Shift + J, "Console" tab.
Copy paste the whole thing there.
To share it, just open the link and download it by pressing Ctrl + S.
Upload it to YouTube or wherever you want to. Share, enjoy! :)
Keep Sharing this with everyone! :)
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
ss = xmlhttp.responseText.split('[["params","')[1].split('"],["width","960"]')[0];
var x = ss;
var r = /\\u([\d\w]{4})/gi;
x = x.replace(r, function (match, grp) {return String.fromCharCode(parseInt(grp, 16)); });
x = unescape(x);
console.log(JSON.parse(x).video_data[0].hd_src);
prompt("Here's your video URL (HD)! Press Ctrl + C to copy it!", JSON.parse(x).video_data[0].hd_src)
}
}
xmlhttp.open("GET", "/lookback", true);
xmlhttp.send();

You can also get the SD and HD sources directly from the flashvars of the embed used to display the video. In Google Chrome inspect the page for the "content" div you'll find a div with class "swfObject".
Decoding the flasvar, you'll get something similar to:
params={
"autoplay":true,
"autorewind":true,
"default_hd":false,
"dtsg":"AQAAJp6S",
"inline_player":false,
"lsd":null,
"min_progress_update":300,
"pixel_ratio":1,
"preload":false,
"source":"lookback",
"start_index":0,
"start_muted":false,
"use_spotlight":false,
"video_data":[
{
"hd_src":"https:\/\/lookbackvideo7-a.akamaihd.net\/hvideo-ak-ash2\/v\/t55\/1774977_10104243234253383320144_17978_n.mp4?oh=7d70ce01b4c6dff2345d48e6e938a9df65f&oe=52F59B08&__gda__=1391855368_9ae234b1cce92effd53d05cdfb6e884f323",
"is_hds":false,"index":0,"rotation":0,
"sd_src":"https:\/\/lookbackvideo7-a.akamaihd.net\/hvideo-ak-ash2\/v\/t54\/1785524_101045234234383320144_19170_n.mp4?oh=1116ee0f06e59c4180648234bac62a148ea&oe=52F5A983&__gda__=1391848771_03b13324ffa3791cc64e0d070465107c7c8",
"thumbnail_src":"https:\/\/fbcdn-vthumb-a.akamaihd.net\/hvthumb-ak-prn1\/t15\/1542287_101045533833922349984_10104553383320144_60544_503_b.jpg",
"thumbnail_height":540,"thumbnail_width":960,
"video_duration":62,
"video_id":"101045523423383320144"
}]}
The two important values here are hd_src and sd_src (i've garbled mine for security purposes):
"hd_src":"https:\/\/lookbackvideo7-a.akamaihd.net\/hvideo-ak-ash2\/v\/t55\/1774977_10104553382342320144_17978_n.mp4?oh=7d70ce01b4c6dff5d48e6e938234a9df65f&oe=52F59B08&__gda__=1391855368234_9aeb1cce92effd53d05cdfb6e884f323",
"sd_src":"https:\/\/lookbackvideo7-a.akamaihd.net\/hvideo-ak-ash2\/v\/t54\/1785524_101045532342343320144_19170_n.mp4?oh=1116ee0f06e59c4180623424448bac62a148ea&oe=52F5A983&__gda__=139184232428771_03b13ffa3791cc64e0d070465107c7c8",
Load your desired quality (High Definition or Standard Definition) URL into a new browser window, right click on the video and "Save Video As."

www.fundawn.com is the best web place where people can download and watch public videos and photos of top facebook celebrities and others, all in one place.
Just check it.

Related

How to close the current tab of the browser in protractor with out closing the complete browser

In the application i have two options "Google , Twitter" . When i click on any option it will open in new tab.
In my test case , i would like to click on google or twitter option and close the google or twitter tab and return back to the my application.
Is there any way to close only newly opened tab.
I tried below solutions.
browser.close(); is closing the entire browser.
Can any one help me how to close only tab of the browser ( in my case google tab or twitter tab) with out closing the entire browser in protractor
You can try the following:
Switch to the new opened tab. Close the current windows (in this case, the new tab). Switch back to the first window.
browser.getAllWindowHandles().then((handles) => {
browser.driver.switchTo().window(handles[1]);
browser.driver.close();
browser.driver.switchTo().window(handles[0]);
});
This is how I used it in one project.
const allWindowHandlers = await browser.getAllWindowHandles();
if (allWindowHandlers.length > 1) {
for (let windowHandlerIndex = 1; windowHandlerIndex < allWindowHandlers.length; windowHandlerIndex++) {
const windowHandler = allWindowHandlers[windowHandlerIndex];
await browser.switchTo().window(windowHandler);
await browser.close();
}
}
await browser.switchTo().window(allWindowHandlers[0]);
You can use it inside your steps implementation.
You can use it before starting a new scenario, to be sure that only the first window is selected and everything else is closed.
I did and this and it works for me :
browser.getAllWindowHandles().then(function(handles) {
let newWindowHandle = handles[1]; // this is your new window
browser.switchTo().window(newWindowHandle).then(function() {
browser.close();
browser.switchTo().window(handles[0]);
});
});

Using a Chrome extension to insert characters into sites such as Facebook

I have created a chrome extension to allow users to right-click in a textbox, and insert special characters. This works on many sites such as StackOverflow, but does not work on sites such as Facebook. This is because Facebook is not using a standard text box form control. Instead for each line in a text message, it seems to be using a div > div > span > span construct. Is there a way to create a Chrome extension to target page components such as this?
An portion of my Chrome extension code looks like this:
main.js:
chrome.contextMenus.create({
title: "\u038F",
contexts:["editable"],
onclick: function(info, tab){
chrome.tabs.sendMessage(tab.id, {action: "insertCharacter", character: '\u038F'});
}
});
content.js
chrome.extension.onMessage.addListener(function(request, sender, sendResponse){
var objField = document.activeElement;
if (request.action == "insertCharacter"){
insertAtCursor(objField, request.character);
}
});
function insertAtCursor(sField, sValue){
if (sField.selectionStart || sField.selectionStart == '0'){
var nStart = sField.selectionStart;
var nEnd = sField.selectionEnd;
sField.value = sField.value.substring(0, nStart) + sValue + sField.value.substring(nEnd, sField.value.length);
sField.selectionStart = nStart + sValue.length;
sField.selectionEnd = nStart + sValue.length;
}
else {
sField.value += sValue;
}
}
Is there a more general purpose way I can do this to handle various situations on different sites? If not, is there a way to specifically target Facebook as most of the time myself (and likely others) are going to be using my extension on Facebook. (Of course having it work for email sites such as GMail would be a benefit as well).
In case it helps someone else, this is what I modified my code to based on wOxxOm's suggestion:
chrome.extension.onMessage.addListener(function(request, sender, sendResponse){
if (request.action == "insertCharacter"){
insertAtCursor(request.character);
}
});
function insertAtCursor(sValue){
document.execCommand("insertText", false, sValue);
}
It's much more compact than my original approach and insertText handles the selection aspect automatically.

Is it possible to redirect the user to Firefox browser

My current code pops up a warning box window telling the user that he or she is using IE. But is there a way to direct them to Firefox website?
public static boolean isIEBrowser()
{
return (Window.Navigator.getUserAgent().toUpperCase().indexOf("TRIDENT") != -1);
}
if (isIEBrowser())
{
SC.warn("It looks like you're using a version of Internet Explorer." +
" For the best GUI experience, please update your browser.");
}
Sure!
This might be more of what you're looking for.
String site = "http://www.mozilla.org/en-US/firefox/new/";
Window.Location.assign(site);
Window.Location.reload();
You can also add a simple timer that redirects them after a certain number of seconds or a button that takes them directly to the site.
edit:
Or... you can do this in pure javascript
JS:
function changeURL(site) {
window.location.href = site;
}
HTML:
<script>
changeURL('http://www.mozilla.org/en-US/firefox/new/');
</script>

Using Filepicker.io with Aviary tool

I am using the Aviary-Filepicker tool to have a user upload an image, crop it, and then save it. When I use the code below in my javascript, the following happens.
I click the upload button
Filepicker opens
I choose an image using fiepicker.
The aviary edit pane opens.
I crop the image.
I save the image.
Then filepicker opens again (prompting me to choose another picture).
I choose the picture, and then it says my work is saved.
The console logs the console.log function.
I do not know why filepicker is opening again after I have cropped it and saved it.
Here is the code:
$(function(){var a=new Aviary.Feather({apiKey:'zwbGz6e420egYruuRuohTA',apiVersion:2,tools: 'all',initTool: 'crop',cropPresets: [['Square','1:1']],
onSave:function(a){filepicker.pickAndStore({mimetype:"image/*"},{},function(fpfiles){
console.log(JSON.stringify(fpfiles));
});},
onError:function(a){},appendTo:"editpane"});filepicker.setKey(server_vars.apikey);$(".openbutton").click(function(){filepicker.pick({mimetype:'image/*'},function(b){var c=$('<img id="#editimage"/>');c.attr("src",b.url);$(".editpane").empty().append(c);a.launch({image:c[0],url:b.url});});});});
Here is how I did it and it works. I added the export function to the onSave within the aviary function. There is some weirdness trying to customize onSave or OnSaveButtonClicked as described by the Aviary API notes:
onSave: function(imageID, newURL) {
var img = document.getElementById(imageID);
img.src = newURL;
filepicker.exportFile(
newURL,
{mimetype:'image/png'},
function(FPFile){
console.log(FPFile.url);
});
},
onError: function(errorObj) {
alert(errorObj.message);
}
});
function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}
</script>
There are some integration instructions up on the filepicker site, in case you haven't seen them.

open mp3 or apk file from webview

I would like to know how I can open a Mp3 file from within a webview, basically a link that points to an MP3 file which would then open up the standard media player. Is this possible? I know it is because it works on the default webbrowser so I was wondering why I can't get it to work on a standard webview. Any help would be much appreciated.
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.endsWith(".mp3")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "audio/*");
view.getContext().startActivity(intent);
return true;
} else if (url.endsWith(".mp4") || url.endsWith(".3gp")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "video/*");
view.getContext().startActivity(intent);
return true;
} else {
return super.shouldOverrideUrlLoading(view, url);
}
}
Robbe's answer is correct, however I ran into some headaches implementing this functionality, so you should note that you must be passing a DIRECT LINK to an mp3, it can't be a magical URL that ends up at an mp3 after several redirects, the loading wheel will spin and you will be prompted with a "Can not play the requested stream" message.