-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEyeTube_Lin.py
More file actions
24 lines (23 loc) · 755 Bytes
/
Copy pathEyeTube_Lin.py
File metadata and controls
24 lines (23 loc) · 755 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
import yt_dlp
#STAGE 3b
def download_linkedin_video(url):
ydl_opts = {
'format': 'bestvideo+bestaudio/best',
'noplaylist': True,
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(url, download=False)
if info_dict:
if 'entries' in info_dict:
# If it's a playlist or multiple entries
video_url = info_dict['entries'][0]['url']
else:
# Single video
video_url = info_dict['url']
return video_url
else:
return None
except Exception as e:
print(f"Error downloading LinkedIn video: {e}")
return None