C
C
Chesterfield252021-11-26 18:49:18
Java
Chesterfield25, 2021-11-26 18:49:18

How to download videos from facebook?

There is an application that downloads videos from facebook. Video downloads only from such links

https://www.facebook.com/serpro/videos/000000000000000/

What needs to be fixed to download videos from such links? https://fb.watch/9wKMFjmS0g/
The code that is responsible for downloading the video

class CallGetFbData extends AsyncTask<String, Void, Document>{

        Document fbDoc;
        @Override
        protected Document doInBackground(String... strings) {
            try {
                fbDoc = Jsoup.connect(strings[0]).get();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return fbDoc;
        }

        @Override
        protected void onPostExecute(Document document) {
            try {
                String videoUrl = document.select("meta[property=\"og:video\"]")
                        .last().attr("content");
                if(!videoUrl.equals(""))
                    Util.download(videoUrl, Util.RootDirectoryFacebook, activity, "facebook" + System.currentTimeMillis() + ".mp4");
            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(activity, R.string.url_is_invalid, Toast.LENGTH_SHORT).show();
            }

        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-11-26
@rPman

replace the code with a call to the latest version of the youtube-dl utility link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question