How to extract the direct facebook video url












2















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 :)










share|improve this question























  • have you got any lead on this ?

    – Darshan Soni
    Feb 9 '17 at 7:59
















2















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 :)










share|improve this question























  • have you got any lead on this ?

    – Darshan Soni
    Feb 9 '17 at 7:59














2












2








2


1






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 :)










share|improve this question














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 :)







javascript php facebook facebook-graph-api video






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 24 '16 at 16:09









gapc311gapc311

49128




49128













  • have you got any lead on this ?

    – Darshan Soni
    Feb 9 '17 at 7:59



















  • have you got any lead on this ?

    – Darshan Soni
    Feb 9 '17 at 7:59

















have you got any lead on this ?

– Darshan Soni
Feb 9 '17 at 7:59





have you got any lead on this ?

– Darshan Soni
Feb 9 '17 at 7:59












4 Answers
4






active

oldest

votes


















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! :)






share|improve this answer































    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"





    share|improve this answer



















    • 2





      "source" has been removed now. Can you please update if you know new way to findout this url.

      – Pankaj Kumar
      May 9 '18 at 10:43



















    0














    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
      h t t p s : w w w .f ac e bo o k. c om /... 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[enter image description here]



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






    share|improve this answer
























    • This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

      – Bill Kotsias
      Jan 26 at 15:27











    • Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

      – Jeeva
      10 hours ago



















    0














    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)





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34978051%2fhow-to-extract-the-direct-facebook-video-url%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      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! :)






      share|improve this answer




























        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! :)






        share|improve this answer


























          3












          3








          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! :)






          share|improve this answer













          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! :)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 24 '16 at 17:01









          DougieHauserDougieHauser

          480413




          480413

























              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"





              share|improve this answer



















              • 2





                "source" has been removed now. Can you please update if you know new way to findout this url.

                – Pankaj Kumar
                May 9 '18 at 10:43
















              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"





              share|improve this answer



















              • 2





                "source" has been removed now. Can you please update if you know new way to findout this url.

                – Pankaj Kumar
                May 9 '18 at 10:43














              2












              2








              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"





              share|improve this answer













              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"






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jun 29 '17 at 6:49









              Phạm Văn TrungPhạm Văn Trung

              312




              312








              • 2





                "source" has been removed now. Can you please update if you know new way to findout this url.

                – Pankaj Kumar
                May 9 '18 at 10:43














              • 2





                "source" has been removed now. Can you please update if you know new way to findout this url.

                – Pankaj Kumar
                May 9 '18 at 10:43








              2




              2





              "source" has been removed now. Can you please update if you know new way to findout this url.

              – Pankaj Kumar
              May 9 '18 at 10:43





              "source" has been removed now. Can you please update if you know new way to findout this url.

              – Pankaj Kumar
              May 9 '18 at 10:43











              0














              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
                h t t p s : w w w .f ac e bo o k. c om /... 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[enter image description here]



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






              share|improve this answer
























              • This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

                – Bill Kotsias
                Jan 26 at 15:27











              • Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

                – Jeeva
                10 hours ago
















              0














              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
                h t t p s : w w w .f ac e bo o k. c om /... 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[enter image description here]



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






              share|improve this answer
























              • This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

                – Bill Kotsias
                Jan 26 at 15:27











              • Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

                – Jeeva
                10 hours ago














              0












              0








              0







              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
                h t t p s : w w w .f ac e bo o k. c om /... 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[enter image description here]



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






              share|improve this answer













              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
                h t t p s : w w w .f ac e bo o k. c om /... 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[enter image description here]



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







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 18 '17 at 14:56









              QuanVNQuanVN

              5216




              5216













              • This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

                – Bill Kotsias
                Jan 26 at 15:27











              • Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

                – Jeeva
                10 hours ago



















              • This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

                – Bill Kotsias
                Jan 26 at 15:27











              • Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

                – Jeeva
                10 hours ago

















              This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

              – Bill Kotsias
              Jan 26 at 15:27





              This is in fact the correct answer, was able to extract link with Chrome developer tools through m.facebook...

              – Bill Kotsias
              Jan 26 at 15:27













              Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

              – Jeeva
              10 hours ago





              Thanks, I can able to load the mobile version of the facebook and I intercepted all the URLs and able to extract the original downloading file

              – Jeeva
              10 hours ago











              0














              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)





              share|improve this answer




























                0














                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)





                share|improve this answer


























                  0












                  0








                  0







                  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)





                  share|improve this answer













                  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)






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 7 at 14:53









                  Ashfaq AhmedAshfaq Ahmed

                  1,13331529




                  1,13331529






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34978051%2fhow-to-extract-the-direct-facebook-video-url%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to change which sound is reproduced for terminal bell?

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents