November 23, 2024
How to

Download Facebook video using Python Best

Download Facebook video using Python Social media has become a popular medium for sharing content and news, as well as social interaction. Facebook is one of the most popular social media platforms that makes it easy to keep in touch with friends and share content. There are many informative and fun videos that you have probably seen on Facebook. You may have felt the urge to download certain videos for later viewing. Python enthusiasts will be pleased to learn that any Facebook video can be downloaded using Python.

This tutorial will show you how to do the same.

Download Facebook video using Python
Download Facebook video using Python

Steps to Download Facebook video using Python

1. Import required modules:

sys– This module allows you to manipulate the Python runtime environment. This allows you to access variables and interpreter functions.
os– It allows you to interact with the operating system. (accessing different paths etc. ).
requests- This is a Python module that sends HTTP requests.
wget- This Python utility module allows you to download files from the Internet server.

import sys
import os
import requests as r
import wget
filedir = os.path.join('C:/Users/varsh/Downloads')
try:
LINK = "https://www.facebook.com/peopleareawesome/videos/637730157348346/" #url of video to be downloaded
html = r.get(LINK)
except r.ConnectionError as e:
print("Error in connecting")
except r.Timeout as e:
print("Timeout")
except r.RequestException as e:
print("Invalid URL")
except (KeyboardInterrupt, SystemExit):
print("System has quit")
sys.exit(1)
except TypeError:
print("Video seems to be private ")
else:
print("\n")
print("Video Quality:Normal " )
print("[+] Starting Download")
wget.download(LINK,filedir)
print("\n")
print("Video downloaded")
Video Quality:Normal 
[+] Starting Download
-1 / unknown

Video downloaded

Adblock For Youtube

Adblock For Youtube

Adblock for youtube not working

    • 11 months ago

    […] Download Facebook video using Python. […]

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image

7 + eleven =