-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEyeTube_Face.py
More file actions
26 lines (22 loc) · 764 Bytes
/
Copy pathEyeTube_Face.py
File metadata and controls
26 lines (22 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import yt_dlp
import logging
#STAGE 3b
#Funtion that fetches and downloads the Video from Facebook
def download_facebook_video(url):
ydl_opts = {
'format': 'best',
'noplaylist': True,
'outtmpl': '%(title)s - %(uploader)s - %(upload_date)s.%(ext)s',
'quiet': True,
'extract_flat': 'in_playlist',
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(url, download=False)
if 'entries' in info_dict:
video_format = info_dict['entries'][0]
else:
video_format = info_dict
download_url = video_format.get('url')
if not download_url:
raise ValueError("Could not extract video URL.")
return download_url