Spaces:
Runtime error
Runtime error
Update server.py
Browse files
server.py
CHANGED
@@ -5,27 +5,6 @@ import json
|
|
5 |
import base64
|
6 |
import yt_dlp
|
7 |
import os
|
8 |
-
|
9 |
-
def download_video_with_cookies(video_url, cookies_path):
|
10 |
-
# Define options for yt-dlp
|
11 |
-
ydl_opts = {
|
12 |
-
'cookies': cookies_path, # Path to the cookies file
|
13 |
-
'outtmpl': 'downloads/%(title)s.%(ext)s', # Define the output file template
|
14 |
-
}
|
15 |
-
|
16 |
-
# Using yt-dlp to download the video
|
17 |
-
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
18 |
-
ydl.download([video_url]) # Downloads the video
|
19 |
-
|
20 |
-
# Path to the cookies.txt file in your Hugging Face Space
|
21 |
-
cookies_file = '/mnt/data/cookies.txt' # You will need to upload the cookies.txt file here
|
22 |
-
|
23 |
-
# Example video URL
|
24 |
-
video_url = 'https://www.youtube.com/watch?v=kffacxfA7G4' # Replace with the desired YouTube video URL
|
25 |
-
|
26 |
-
# Call the download function
|
27 |
-
download_video_with_cookies(video_url, cookies_file)
|
28 |
-
|
29 |
import re
|
30 |
import logging
|
31 |
from typing import Union
|
|
|
5 |
import base64
|
6 |
import yt_dlp
|
7 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
import re
|
9 |
import logging
|
10 |
from typing import Union
|