Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extracts the HD video link from the Facebook lookback page.
var xLBD = {};
xLBD.c = function (){
xLBD.f = unescape(document.querySelector("[flashvars]").getAttribute("flashvars")).substring(7);
xLBD.f = JSON.parse(xLBD.f.substring(0, xLBD.f.lastIndexOf("}") + 1)).video_data[0].hd_src;
xLBD.a = "<div style='position:absolute;top:100px;height:300px;left:15%;background:#fff;border:10px solid #000;font-size:5em;padding:100px;'>Click <a download='lookback.mp4' href='"+xLBD.f+"'>here<\/a> to download your lookBack video.</div>";
document.body.innerHTML += xLBD.a;
}
if(document.readyState == "complete")
xLBD.c();
else window.onload = xLBD.c;
@waseefakhtar

This comment has been minimized.

Copy link

commented Feb 4, 2014

Brilliant work, xadhix! Thanks a ton.

@Gazer

This comment has been minimized.

Copy link

commented Feb 4, 2014

Thanks!!

@naveen-rn

This comment has been minimized.

Copy link

commented Feb 4, 2014

thanks dude

@iwebsource

This comment has been minimized.

Copy link

commented Feb 4, 2014

Sorry for my ignorance, what file extension should I save it as? I have a linux server and also run Windows at home. Just not sure how to execute this.

Thanks guys!

Regards,

@DanielrobertsUS

This comment has been minimized.

Copy link

commented Feb 4, 2014

You can follow these steps:

  1. Copy the code (lines 1-10) above.
  2. Go to https://www.facebook.com/lookback
  3. Press Ctrl-Shift-J (that will open up a bar at the bottom of the screen)
  4. Click Console
  5. Next to the blue arrow paste the code in step 1.
@iwebsource

This comment has been minimized.

Copy link

commented Feb 4, 2014

Thank you so much DanielrobertsUS!

Cheers!

@blz777

This comment has been minimized.

Copy link

commented Feb 4, 2014

Thank you! :)))

@gdpont

This comment has been minimized.

Copy link

commented Feb 4, 2014

I am getting an error of "TypeError: Cannot call method 'getAttribute' of null:"

@1000cupcakes

This comment has been minimized.

Copy link

commented Feb 4, 2014

PLEASE HELP,
I am getting an error of "TypeError: Cannot call method 'getAttribute' of null:"

@ironbishop

This comment has been minimized.

Copy link

commented Feb 4, 2014

btw Facebook just added the "Share" button

@1000cupcakes are you using Firefox?

@1000cupcakes

This comment has been minimized.

Copy link

commented Feb 4, 2014

I am using windows/ google chrome

@gabydgb

This comment has been minimized.

Copy link

commented Feb 4, 2014

Im using firefox/windows and im getting: TypeError: document.querySelector(...) is null

@gabydgb

This comment has been minimized.

Copy link

commented Feb 4, 2014

help ? :(

@ironbishop

This comment has been minimized.

Copy link

commented Feb 4, 2014

I can try with Windows tomorrow, now I don't have one. It should not be a system issue, though.

@BhavyaTayal

This comment has been minimized.

Copy link

commented Feb 4, 2014

What you all are doing is opening Browser console by pressing Shift+Control+J, dont do that.

Simply go to tools -> developer options -> Web console and then execute this command...:)...i think the shortcut for that is Alt+Ctrl+K

i am writing for Firefox but i am sure you will figure out for Chrome as well....Best of luck...;)

@arunshivaram

This comment has been minimized.

Copy link

commented Feb 4, 2014

The shortcut for opening the web console in Firefox is Ctrl+Shift+K . In Chrome, it is Ctrl+Shift+J.

@a-r-m-i-n

This comment has been minimized.

Copy link

commented Feb 4, 2014

Here you'll find an alternative way, without using javascript: http://goo.gl/D1vAQ9

@TheITJuggler

This comment has been minimized.

Copy link

commented Feb 4, 2014

Awesome sauce! Thanks!

@malefevere

This comment has been minimized.

Copy link

commented Feb 5, 2014

I must be total stupid, I followed the instructions DanielrobertsUS and it didn't work unless there is a step that is missing... I am using Firefox / Windows 8.1
SOMEONE PLEASE HELP! I want to get the link to create the lookback video.
We deleted ours thinking we could click it again and edit the captions only to find out now all we have is a page of pictures. PLEASE, PLEASE, PLEASE HELP us figure this out!!! I will be eternally grateful

Get an error message:
Unable to get property 'getAttribute' of undefined or null reference

@sisodiakaran

This comment has been minimized.

Copy link

commented Feb 5, 2014

Thanks it worked great !!!!

@dawnsparangis

This comment has been minimized.

Copy link

commented Feb 5, 2014

I am not the best with computers... followed the steps above.... It is sure downloading a ton of stuff. Does it take a long time or did I do something wrong?

@Jay21

This comment has been minimized.

Copy link

commented Feb 5, 2014

this isn't working? I also deleted mine and can't get it back????

@dawnsparangis

This comment has been minimized.

Copy link

commented Feb 5, 2014

I followed the steps above that DanielrobertsUS listed. I have been downloading stuff for over 45 minutes.... Will stop in 10 more minutes and do a system clean and a factory reset if needed. Seems an extreme amount of time.

@ironbishop

This comment has been minimized.

Copy link

commented Feb 5, 2014

UPDATE if this doesn't work, you can use Video Download Helper (Firefox extension)

@gdpont , @1000cupcakes , @gabydgb , @malefevere : on Windows, queryselector works differently. Try this code instead and let me know (worked for me in Firefox on Windows, and Chrome on Windows) Edit: no need of new code, @BhavyaTayal got it right: in Firefox CTRL+SHIFT+j opens the wrong console (unlinked to current page!), CTRL+SHIFT+k is right (or click "Web Console" in menù bar)

var xLBD = {};
xLBD.c = function (){
xLBD.f = unescape(document.embeds[0].getAttribute("flashvars")).substring(7);
xLBD.f = JSON.parse(xLBD.f.substring(0, xLBD.f.lastIndexOf("}") + 1)).video_data[0].hd_src;
xLBD.a = "<div style='position:absolute;top:100px;height:300px;left:15%;background:#fff;border:10px solid #000;font-size:5em;padding:100px;'>Click <a download='lookback.mp4' href='"+xLBD.f+"'>here<\/a> to download your lookBack video.</div>";
document.body.innerHTML += xLBD.a;
}
if(document.readyState == "complete")
xLBD.c();
else window.onload = xLBD.c;
@chbrandt85

This comment has been minimized.

Copy link

commented Feb 5, 2014

For those of you who don't have a video showing up but viewed it in Firefox:

? edited 36 mins ago

I was able to download my video on Firefox.
First you need to not close your browser or clear your cache since you watched the video.

  1. In Firefox, type "about:cache" into the URL field and enter
  2. Click the "List Cache Entries" button under the "Disk Cache Device" field.
  3. Do a search for mp4. I found a few and the one closest to the time I viewed my video ended up being the correct link. It looks like https://lookbackvideo4-a.akamaihd.net/hvideo-ak-frc3.mp4? ... I opened the link in a new tab, clicked the link, and the video played in its own tab. I went to File, Save As, and saved the .mp4 file

For chrome:

Dani edited 18 mins ago
If you used Chrome when you watched your video prior to deleting, just do these:

  1. Type about:cache on your chrome search bar (provided that you don't clear history/cache after you close your browser)
  2. You will see a list of links on your window, just click Ctrl F or ⌘ F to and search "lookback" in the Find searchbar
  3. Look for the link that will have something like https://lookbackvideo7-a.akamaihd.net/hvideo and so on. Click that link.
  4. After you clicked the link, you will see on your window a bunch of text with white background. Ignore that. LOOK AT YOUR URL BAR. You should be able to see something like chrome://view-http-cache/https://lookbackvideo7-a.akamaihd.net/hvideo-ak-prn etc etc. In the long string of url, DELETE THIS PART: chrome://view-http-cache/ then press enter.
  5. You should be able to see your video again. Right click and choose "Save Video As" and just reupload on your Facebook timeline, Youtube, or anywhere.
@JibranAhmed

This comment has been minimized.

Copy link

commented Feb 5, 2014

Sorry but when i paste in my google chrome . this error occurs in console

TypeError: Cannot call method 'getAttribute' of null

Please Help

@JibranAhmed

This comment has been minimized.

Copy link

commented Feb 5, 2014

Sorry but when i paste in console this error occurs

TypeError: Cannot call method 'getAttribute' of null

Please Help

@ironbishop

This comment has been minimized.

Copy link

commented Feb 5, 2014

@ JibranAhmed you need to use "Web Console" (CTRL+SHIFT+k), not "Browser Console"

browser combo
Firefox CTRL+SHIFT+k
Chrome CTRL+SHIFT+j
Safari CTRL+ALT+i
Opera CTRL+SHIFT+i
Internet Explorer F12 ...then click "Console"
@NitaAnn

This comment has been minimized.

Copy link

commented Feb 5, 2014

When I go to get the video via facebook/lookback

  1. I get 6 pictures and a thank you.
  2. When I attempted to use the script I get "TypeError: Cannot call method 'getAttribute' of null"
  3. I've tried it in firefox and google chrome.
    Any other solutions
@ironbishop

This comment has been minimized.

Copy link

commented Feb 5, 2014

@NitaAnn if you only see pictures, there is nothing to download so the script fails... try with chbrandt85 solution

@naushonly

This comment has been minimized.

Copy link

commented Feb 5, 2014

I viewed my video on facebook app of my iphone 5 and afterwards i accidentally deleted it. i tried all solutions mentioned in this thread, still hoping to find some solution :/

@JibranAhmed

This comment has been minimized.

Copy link

commented Feb 5, 2014

@ironbishop . please elaborate

@NitaAnn

This comment has been minimized.

Copy link

commented Feb 5, 2014

@ironbishop. I was hoping to retrieve the video that produced yesterday that I didn't share because I wanted to delete one picture. Big mistake. I don't think it will be in my cache files since I have closed my browser several times since yesterday. I guess I'm out of luck and solutions. Thanks for your assistance.

@marinewife

This comment has been minimized.

Copy link

commented Feb 5, 2014

Ok, my dumbass tried all of these solutions on the computer but then I remembered I had deleted my video on my iPhone 5S using the Facebook app. Is there hope to still get it back? UGH.

@princeof1990

This comment has been minimized.

Copy link

commented Feb 5, 2014

Brilliant.!! Thank u very much.. :)

@vishnupadmanabhan

This comment has been minimized.

Copy link

commented Feb 5, 2014

Awesome!

@liliam

This comment has been minimized.

Copy link

commented Feb 5, 2014

a mi el codigo me da error, por favor necesito ayuda, me dijeron que si borraba la cache podria volver a compartir el video, lo hice y tampoco me deja, ayuda por favor, lo siento pero no se ingles, alguien me puede ayudar?

@ironbishop

This comment has been minimized.

Copy link

commented Feb 6, 2014

If you have deleted the video, your only option is to ask for assistance to Facebook helpdesk.
Si ha eliminado el vídeo, su única opción es pedir ayuda a Facebook helpdesk.

@liliam

This comment has been minimized.

Copy link

commented Feb 6, 2014

ok thx

@digitaltoast

This comment has been minimized.

Copy link

commented Feb 6, 2014

Great news - you can now edit the video and make a new one - try it! And it seems those people that were missing the video can now make one, too. Thank you for this script, too!

@davorb

This comment has been minimized.

Copy link

commented Aug 30, 2014

I added support for the ability to download videos that are not available in high-definition, in my fork.

@tittu99

This comment has been minimized.

Copy link

commented Nov 21, 2015

This may Help you: Download Facebook video Online Download Facebook videos in HD.

@furiousjason

This comment has been minimized.

Copy link

commented Feb 11, 2016

Trying to download an arbitrary video, and getting the error

Uncaught TypeError: Cannot read property 'hd_src' of undefined

...I found that this slight alteration works, adding .progressive after video_data, when on a dedicated video page:

var xLBD = {};
xLBD.c = function (){
xLBD.f = unescape(document.querySelector("[flashvars]").getAttribute("flashvars")).substring(7);
xLBD.f = JSON.parse(xLBD.f.substring(0, xLBD.f.lastIndexOf("}") + 1)).video_data.progressive[0].hd_src;
xLBD.a = "<div style='position:absolute;top:100px;height:300px;left:15%;background:#fff;border:10px solid #000;font-size:5em;padding:100px;'>Click <a download='lookback.mp4' href='"+xLBD.f+"'>here<\/a> to download your lookBack video.</div>";
document.body.innerHTML += xLBD.a;
}
if(document.readyState == "complete")
xLBD.c();
else window.onload = xLBD.c;
@lucky1412

This comment has been minimized.

Copy link

commented Aug 31, 2016

how to get Hd video url from video link of facebook
and this is video link of video "https://www.facebook.com/buzzfeedtopknot/videos/1180316385374410/"
please help me out

thanks
Santosh kumar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.