6

I am trying to extract the url for facebook video file page from the facebook video link but I am not able to proceed how.

For example: The facebook video url I have is: https://www.facebook.com/nerdandco/videos/1662140250706521/

The facebook video file url I want to extract is: https://video-ord1-1.xx.fbcdn.net/hvideo-xpf1/v/t42.1790-2/12616394_491864644347782_1646982338_n.mp4?efg=eyJybHIiOjU2NywicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoidjNfNDI2X2NyZl8yM19tYWluXzMuMF9zZCJ9&rl=567&vabr=315&oh=333a80044ec836e9b2228afb58cba6c1&oe=56A51D9B

How to get this url using php or javascript? Thanks in advance :)

gapc311
  • 463
  • 2
  • 6
  • 15

5 Answers5

11

Example Facebook link: I cant post more than 2 links. Sorry about that

Video link: No more than 2 links

  1. Change the www to m https://www.facebook.com... change to https://m.facebook.com/

2.Press Ctrl + Shift + I then press Ctrl + Shift + C

3.Click on the video playback and copy the source code form the

I will give you the picture to show you how it look like

this is the pic

majurageerthan
  • 2,169
  • 3
  • 17
  • 30
3

Here is an example HTTP GET command...

https://graph.facebook.com/v2.5/nerdandco/videos/?fields=backdated_time_granularity,content_category,copyrighted,backdated_time,created_time,description,embeddable,permalink_url,from,embed_html,source,icon,id,is_instagram_eligible,length,picture,place,privacy,published,status,scheduled_publish_time,title,updated_time,captions,comments,sharedposts,likes,tags,thumbnails&limit=10&access_token=<RETRIEVE YOUR OWN ACCESS TOKEN>

Notice that you can play around with the fields you're querying for, the username and the objects you're requesting (in this case, videos).

However, also notice that you must create your own access tokens and that queries you make will have your name on them, (so don't abuse this).

You can play around (and create your own access token) with Facebook's API in their Graph Explorer Tool: https://developers.facebook.com/tools/explorer/

And I'd recommend reading up some more in the Facebook Developers site.

Good luck! :)

DougieHauser
  • 460
  • 6
  • 14
3

Well i have not tried this in PHP, as per the facebook they have removed option in API to return source for the video, so i got it working using Python ;)

import requests as r
import re

url = "EntervideoURLhere"
html = r.get(url)
# for low Quality version
video_url = re.search('sd_src:"(.+?)"', html.text).group(1)
print(video_url)

# for HD version
video_url = re.search('hd_src:"(.+?)"', html.text).group(1)
print(video_url)
Ashfaque Ali Solangi
  • 1,883
  • 3
  • 22
  • 34
2

276508326057504/feed?fields=message,link,created_time,type,name,id,source

source => will return url mp4 video post

  "message": "Face Bank on Banggood",
  "link": "https://www.facebook.com/BanggoodLove/videos/301299256911744/",
  "created_time": "2016-09-01T04:59:49+0000",
  "type": "video",
  "name": "Face Bank",
  "id": "276508326057504_301299256911744",
  "source": "https://video.xx.fbcdn.net/v/t42.1790-2/14226238_1158241977553000_592726978_n.mp4?efg=eyJybHIiOjMwMCwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoidjJfNDAwX2NyZl8yN19tYWluXzMuMF9zZCJ9&rl=300&vabr=100&oh=3f89165b7d605f6c5de724110ba911cf&oe=595660F7"
trungpv
  • 31
  • 2
-1

https://www.facebook.com/nerdandco/videos/1662140250706521/

Change www to mbasic like https://mbasic.facebook.com/nerdandco/videos/1662140250706521/

then click play video and you can download it.