Nymbo commited on
Commit
499b696
·
verified ·
1 Parent(s): 6f71a51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +294 -152
app.py CHANGED
@@ -1,158 +1,300 @@
1
  import gradio as gr
2
  import subprocess
3
- import os
4
- import tempfile
5
-
6
- # Function to run yt-dlp commands and return the file path
7
- def run_yt_dlp(command, url, bitrate=None, start_time=None, end_time=None, playlist_items=None, archive_file=None, cookies_file=None):
8
- # Temporary directory to store the downloaded files
9
- temp_dir = tempfile.mkdtemp()
10
-
11
- # Base command for yt-dlp
12
- base_command = ["yt-dlp", "-f", "bestaudio", "--extract-audio", "--audio-format", "mp3", "--audio-quality", "0", "-o", f"{temp_dir}/%(title)s.%(ext)s"]
13
-
14
- if cookies_file:
15
- base_command.extend(["--cookies", cookies_file])
16
-
17
- if command == "list_formats":
18
- base_command = ["yt-dlp", "-F", url]
19
- elif command == "download_mp3_max_quality":
20
- base_command.extend(["--postprocessor-args", "-b:a 320k", url])
21
- elif command == "basic_high_quality_mp3":
22
- base_command.append(url)
23
- elif command == "custom_bitrate":
24
- base_command.extend(["--postprocessor-args", f"-b:a {bitrate}k", url])
25
- elif command == "add_metadata_tags":
26
- base_command.extend(["--embed-metadata", url])
27
- elif command == "download_playlist":
28
- base_command.append(url)
29
- elif command == "download_playlist_range":
30
- base_command.extend(["--playlist-items", playlist_items, url])
31
- elif command == "download_hq_soundcloud":
32
- base_command.extend(["-o", f"{temp_dir}/%(uploader)s - %(title)s.%(ext)s", url])
33
- elif command == "embed_album_art":
34
- base_command.extend(["--embed-thumbnail", url])
35
- elif command == "download_opus":
36
- base_command.extend(["--audio-format", "opus", url])
37
- elif command == "skip_downloaded_files":
38
- base_command.extend(["--download-archive", archive_file, url])
39
- elif command == "download_multiple_files":
40
- base_command.extend(url.split())
41
- elif command == "download_split_chapters":
42
- base_command.extend(["--split-chapters", url])
43
- elif command == "extract_portion":
44
- base_command.extend(["-f", "bestvideo+bestaudio", "--external-downloader", "ffmpeg", "--external-downloader-args", f"ffmpeg_i:-ss {start_time} -to {end_time}", url])
45
- elif command == "update_metadata":
46
- base_command.extend(["--download-archive", archive_file, "--skip-download", "--embed-metadata", "--embed-thumbnail", url])
47
- elif command == "auto_rename":
48
- base_command.extend(["--force-overwrites", url])
49
- elif command == "download_url_list":
50
- base_command.extend(["-a", url])
51
- elif command == "limit_speed":
52
- base_command.extend(["--rate-limit", "1M", url])
53
- elif command == "download_vimeo":
54
- base_command.extend(["-o", f"{temp_dir}/Vimeo/%(uploader)s - %(title)s.%(ext)s", url])
55
- elif command == "download_facebook":
56
- base_command.extend(["-o", f"{temp_dir}/Facebook/%(uploader)s - %(title)s.%(ext)s", url])
57
- elif command == "download_instagram":
58
- base_command.extend(["-o", f"{temp_dir}/Instagram/%(uploader)s - %(title)s.%(ext)s", url])
59
- elif command == "download_twitter":
60
- base_command.extend(["-o", f"{temp_dir}/Twitter/%(uploader)s - %(title)s.%(ext)s", url])
61
- elif command == "download_tiktok":
62
- base_command.extend(["-o", f"{temp_dir}/TikTok/%(uploader)s - %(title)s.%(ext)s", url])
63
- elif command == "download_reddit":
64
- base_command.extend(["-o", f"{temp_dir}/Reddit/%(uploader)s - %(title)s.%(ext)s", url])
65
- elif command == "download_dailymotion":
66
- base_command.extend(["-o", f"{temp_dir}/Dailymotion/%(uploader)s - %(title)s.%(ext)s", url])
67
- elif command == "download_transcript_text":
68
- base_command.extend(["--write-auto-subs", "--sub-lang", "en", "--skip-download", url])
69
- elif command == "download_transcript_markdown":
70
- base_command.extend(["--write-auto-subs", "--sub-lang", "en", "--skip-download", "--convert-subs", "srt", "-o", f"{temp_dir}/%(title)s.md", url])
71
- elif command == "download_video_info":
72
- base_command.extend(["--write-info-json", "--skip-download", "-o", f"{temp_dir}/%(title)s.json", url])
73
- elif command == "list_formats_no_download":
74
- base_command = ["yt-dlp", "-F", url]
75
- elif command == "download_age_restricted":
76
- base_command.extend(["--username", "YOUR_YOUTUBE_EMAIL", "--password", "YOUR_PASSWORD", "-f", "bestvideo+bestaudio", url])
77
-
78
  try:
79
- result = subprocess.run(base_command, capture_output=True, text=True)
80
- if result.returncode != 0:
81
- return None, result.stderr
82
- else:
83
- # Find the downloaded file
84
- downloaded_files = [f for f in os.listdir(temp_dir) if os.path.isfile(os.path.join(temp_dir, f))]
85
- if downloaded_files:
86
- file_path = os.path.join(temp_dir, downloaded_files[0])
87
- return file_path, result.stdout
88
- else:
89
- return None, "No file downloaded."
90
- except Exception as e:
91
- return None, str(e)
92
-
93
- # Gradio Interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  with gr.Blocks() as demo:
95
- gr.Markdown("# yt-dlp Command Executor")
96
-
97
- with gr.Row():
98
- command = gr.Dropdown(choices=[
99
- "list_formats",
100
- "download_mp3_max_quality",
101
- "basic_high_quality_mp3",
102
- "custom_bitrate",
103
- "add_metadata_tags",
104
- "download_playlist",
105
- "download_playlist_range",
106
- "download_hq_soundcloud",
107
- "embed_album_art",
108
- "download_opus",
109
- "skip_downloaded_files",
110
- "download_multiple_files",
111
- "download_split_chapters",
112
- "extract_portion",
113
- "update_metadata",
114
- "auto_rename",
115
- "download_url_list",
116
- "limit_speed",
117
- "download_vimeo",
118
- "download_facebook",
119
- "download_instagram",
120
- "download_twitter",
121
- "download_tiktok",
122
- "download_reddit",
123
- "download_dailymotion",
124
- "download_transcript_text",
125
- "download_transcript_markdown",
126
- "download_video_info",
127
- "list_formats_no_download",
128
- "download_age_restricted"
129
- ], label="Command")
130
-
131
- url = gr.Textbox(label="URL", placeholder="Enter the URL here")
132
-
133
- with gr.Row():
134
- bitrate = gr.Textbox(label="Bitrate (for custom bitrate)", placeholder="Enter bitrate in kbps, e.g., 192")
135
- start_time = gr.Textbox(label="Start Time (HH:MM:SS)", placeholder="Enter start time, e.g., 00:01:00")
136
- end_time = gr.Textbox(label="End Time (HH:MM:SS)", placeholder="Enter end time, e.g., 00:05:00")
137
- playlist_items = gr.Textbox(label="Playlist Items (e.g., 1-5)", placeholder="Enter range of items, e.g., 1-5")
138
- archive_file = gr.Textbox(label="Archive File", placeholder="Enter path to archive file, e.g., P:/Local Music/downloaded.txt")
139
- cookies_file = gr.Textbox(label="Cookies File", placeholder="Enter path to cookies file, e.g., P:/cookies.txt")
140
-
141
- execute_button = gr.Button("Execute Command")
142
- file_output = gr.File(label="Downloaded File")
143
- output = gr.Textbox(label="Output", lines=10)
144
-
145
- def execute_and_download(command, url, bitrate, start_time, end_time, playlist_items, archive_file, cookies_file):
146
- file_path, result = run_yt_dlp(command, url, bitrate, start_time, end_time, playlist_items, archive_file, cookies_file)
147
- if file_path:
148
- return file_path, result
149
- else:
150
- return None, result
151
-
152
- execute_button.click(
153
- fn=execute_and_download,
154
- inputs=[command, url, bitrate, start_time, end_time, playlist_items, archive_file, cookies_file],
155
- outputs=[file_output, output]
156
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  demo.launch()
 
1
  import gradio as gr
2
  import subprocess
3
+
4
+ def run_yt_dlp_command(command):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  try:
6
+ result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
7
+ return result.stdout
8
+ except subprocess.CalledProcessError as e:
9
+ return e.stderr
10
+
11
+ def list_available_formats(url):
12
+ command = f'yt-dlp -F "{url}"'
13
+ return run_yt_dlp_command(command)
14
+
15
+ def download_mp3_max_quality(url):
16
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --postprocessor-args "-b:a 320k" -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
17
+ return run_yt_dlp_command(command)
18
+
19
+ def basic_high_quality_mp3_download(url):
20
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
21
+ return run_yt_dlp_command(command)
22
+
23
+ def download_custom_bitrate(url, bitrate):
24
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --postprocessor-args "-b:a {bitrate}k" -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
25
+ return run_yt_dlp_command(command)
26
+
27
+ def download_and_add_metadata_tags(url):
28
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --embed-metadata -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
29
+ return run_yt_dlp_command(command)
30
+
31
+ def download_entire_playlist(url):
32
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/%(playlist_title)s/%(title)s.%(ext)s" "{url}"'
33
+ return run_yt_dlp_command(command)
34
+
35
+ def download_playlist_specific_range(url, start, end):
36
+ command = f'yt-dlp --playlist-items {start}-{end} -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/%(playlist_title)s/%(title)s.%(ext)s" "{url}"'
37
+ return run_yt_dlp_command(command)
38
+
39
+ def download_hq_from_soundcloud(url):
40
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/SoundCloud/%(uploader)s - %(title)s.%(ext)s" "{url}"'
41
+ return run_yt_dlp_command(command)
42
+
43
+ def embed_album_art_automatically(url):
44
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --embed-thumbnail --audio-quality 0 -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
45
+ return run_yt_dlp_command(command)
46
+
47
+ def download_specific_formats(url, format):
48
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format {format} -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
49
+ return run_yt_dlp_command(command)
50
+
51
+ def skip_already_downloaded_files(url):
52
+ command = f'yt-dlp --download-archive "P:/Local Music/downloaded.txt" -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
53
+ return run_yt_dlp_command(command)
54
+
55
+ def download_multiple_individual_files(urls):
56
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --add-metadata --embed-thumbnail --write-description --postprocessor-args "-b:a 320k" -o "P:/Local Music/%(title)s.%(ext)s" {" ".join(urls)}'
57
+ return run_yt_dlp_command(command)
58
+
59
+ def download_and_split_by_chapters(url):
60
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --split-chapters -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
61
+ return run_yt_dlp_command(command)
62
+
63
+ def extract_portion_of_video(url, start_time, end_time):
64
+ command = f'yt-dlp -f bestvideo+bestaudio --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss {start_time} -to {end_time}" -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
65
+ return run_yt_dlp_command(command)
66
+
67
+ def update_metadata_of_existing_files(url):
68
+ command = f'yt-dlp --download-archive "P:/Local Music/downloaded.txt" --skip-download --embed-metadata --embed-thumbnail --write-description "{url}"'
69
+ return run_yt_dlp_command(command)
70
+
71
+ def auto_rename_duplicate_files(url):
72
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --force-overwrites -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
73
+ return run_yt_dlp_command(command)
74
+
75
+ def download_from_url_list_file(file_path):
76
+ command = f'yt-dlp -a "{file_path}" -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/%(title)s.%(ext)s"'
77
+ return run_yt_dlp_command(command)
78
+
79
+ def download_and_limit_download_speed(url, speed):
80
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 --rate-limit {speed} -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
81
+ return run_yt_dlp_command(command)
82
+
83
+ def download_from_vimeo(url):
84
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Vimeo/%(uploader)s - %(title)s.%(ext)s" "{url}"'
85
+ return run_yt_dlp_command(command)
86
+
87
+ def download_from_facebook(url):
88
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Facebook/%(uploader)s - %(title)s.%(ext)s" "{url}"'
89
+ return run_yt_dlp_command(command)
90
+
91
+ def download_from_instagram(url):
92
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Instagram/%(uploader)s - %(title)s.%(ext)s" "{url}"'
93
+ return run_yt_dlp_command(command)
94
+
95
+ def download_from_twitter(url):
96
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Twitter/%(uploader)s - %(title)s.%(ext)s" "{url}"'
97
+ return run_yt_dlp_command(command)
98
+
99
+ def download_from_tiktok(url):
100
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/TikTok/%(uploader)s - %(title)s.%(ext)s" "{url}"'
101
+ return run_yt_dlp_command(command)
102
+
103
+ def download_from_reddit(url):
104
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Reddit/%(uploader)s - %(title)s.%(ext)s" "{url}"'
105
+ return run_yt_dlp_command(command)
106
+
107
+ def download_from_dailymotion(url):
108
+ command = f'yt-dlp -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "P:/Local Music/Dailymotion/%(uploader)s - %(title)s.%(ext)s" "{url}"'
109
+ return run_yt_dlp_command(command)
110
+
111
+ def download_youtube_transcript_as_text(url):
112
+ command = f'yt-dlp --write-auto-subs --sub-lang en --skip-download -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
113
+ return run_yt_dlp_command(command)
114
+
115
+ def download_youtube_transcript_as_markdown(url):
116
+ command = f'yt-dlp --write-auto-subs --sub-lang en --skip-download --convert-subs srt -o "P:/Local Music/%(title)s.md" "{url}"'
117
+ return run_yt_dlp_command(command)
118
+
119
+ def download_video_info_and_save_as_json(url):
120
+ command = f'yt-dlp --write-info-json --skip-download -o "P:/Local Music/%(title)s.json" "{url}"'
121
+ return run_yt_dlp_command(command)
122
+
123
+ def list_available_formats_without_downloading(url):
124
+ command = f'yt-dlp -F "{url}"'
125
+ return run_yt_dlp_command(command)
126
+
127
+ def download_from_youtube_age_restricted_content(url, username, password):
128
+ command = f'yt-dlp --username "{username}" --password "{password}" -f bestvideo+bestaudio -o "P:/Local Music/%(title)s.%(ext)s" "{url}"'
129
+ return run_yt_dlp_command(command)
130
+
131
+ # Define the Gradio interface
132
  with gr.Blocks() as demo:
133
+ gr.Markdown("# YT-DLP Commands Interface")
134
+
135
+ with gr.Tab("General Commands"):
136
+ with gr.Row():
137
+ with gr.Column():
138
+ url_input = gr.Textbox(label="URL")
139
+ list_formats_btn = gr.Button("List Available Formats")
140
+ list_formats_btn.click(list_available_formats, inputs=url_input, outputs=gr.Textbox())
141
+
142
+ download_mp3_max_quality_btn = gr.Button("Download MP3 at Max Quality")
143
+ download_mp3_max_quality_btn.click(download_mp3_max_quality, inputs=url_input, outputs=gr.Textbox())
144
+
145
+ basic_high_quality_mp3_download_btn = gr.Button("Basic High-Quality MP3 Download")
146
+ basic_high_quality_mp3_download_btn.click(basic_high_quality_mp3_download, inputs=url_input, outputs=gr.Textbox())
147
+
148
+ custom_bitrate_input = gr.Textbox(label="Custom Bitrate (e.g., 192k)")
149
+ download_custom_bitrate_btn = gr.Button("Download Custom Bitrate")
150
+ download_custom_bitrate_btn.click(download_custom_bitrate, inputs=[url_input, custom_bitrate_input], outputs=gr.Textbox())
151
+
152
+ download_and_add_metadata_tags_btn = gr.Button("Download and Add Metadata Tags")
153
+ download_and_add_metadata_tags_btn.click(download_and_add_metadata_tags, inputs=url_input, outputs=gr.Textbox())
154
+
155
+ download_entire_playlist_btn = gr.Button("Download Entire Playlist")
156
+ download_entire_playlist_btn.click(download_entire_playlist, inputs=url_input, outputs=gr.Textbox())
157
+
158
+ playlist_range_start_input = gr.Textbox(label="Start Index")
159
+ playlist_range_end_input = gr.Textbox(label="End Index")
160
+ download_playlist_specific_range_btn = gr.Button("Download Playlist (Specific Range)")
161
+ download_playlist_specific_range_btn.click(download_playlist_specific_range, inputs=[url_input, playlist_range_start_input, playlist_range_end_input], outputs=gr.Textbox())
162
+
163
+ download_hq_from_soundcloud_btn = gr.Button("Download HQ from SoundCloud")
164
+ download_hq_from_soundcloud_btn.click(download_hq_from_soundcloud, inputs=url_input, outputs=gr.Textbox())
165
+
166
+ embed_album_art_automatically_btn = gr.Button("Embed Album Art Automatically")
167
+ embed_album_art_automatically_btn.click(embed_album_art_automatically, inputs=url_input, outputs=gr.Textbox())
168
+
169
+ specific_format_input = gr.Textbox(label="Specific Format (e.g., opus)")
170
+ download_specific_formats_btn = gr.Button("Download Specific Formats")
171
+ download_specific_formats_btn.click(download_specific_formats, inputs=[url_input, specific_format_input], outputs=gr.Textbox())
172
+
173
+ skip_already_downloaded_files_btn = gr.Button("Skip Already Downloaded Files")
174
+ skip_already_downloaded_files_btn.click(skip_already_downloaded_files, inputs=url_input, outputs=gr.Textbox())
175
+
176
+ multiple_urls_input = gr.Textbox(label="Multiple URLs (space-separated)")
177
+ download_multiple_individual_files_btn = gr.Button("Download Multiple Individual Files")
178
+ download_multiple_individual_files_btn.click(download_multiple_individual_files, inputs=multiple_urls_input, outputs=gr.Textbox())
179
+
180
+ download_and_split_by_chapters_btn = gr.Button("Download and Split by Chapters")
181
+ download_and_split_by_chapters_btn.click(download_and_split_by_chapters, inputs=url_input, outputs=gr.Textbox())
182
+
183
+ start_time_input = gr.Textbox(label="Start Time (e.g., 00:01:00)")
184
+ end_time_input = gr.Textbox(label="End Time (e.g., 00:05:00)")
185
+ extract_portion_of_video_btn = gr.Button("Extract Portion of Video")
186
+ extract_portion_of_video_btn.click(extract_portion_of_video, inputs=[url_input, start_time_input, end_time_input], outputs=gr.Textbox())
187
+
188
+ update_metadata_of_existing_files_btn = gr.Button("Update Metadata of Existing Files")
189
+ update_metadata_of_existing_files_btn.click(update_metadata_of_existing_files, inputs=url_input, outputs=gr.Textbox())
190
+
191
+ auto_rename_duplicate_files_btn = gr.Button("Auto-Rename Duplicate Files")
192
+ auto_rename_duplicate_files_btn.click(auto_rename_duplicate_files, inputs=url_input, outputs=gr.Textbox())
193
+
194
+ url_list_file_input = gr.Textbox(label="URL List File Path")
195
+ download_from_url_list_file_btn = gr.Button("Download from URL List File")
196
+ download_from_url_list_file_btn.click(download_from_url_list_file, inputs=url_list_file_input, outputs=gr.Textbox())
197
+
198
+ download_speed_input = gr.Textbox(label="Download Speed (e.g., 1M)")
199
+ download_and_limit_download_speed_btn = gr.Button("Download and Limit Download Speed")
200
+ download_and_limit_download_speed_btn.click(download_and_limit_download_speed, inputs=[url_input, download_speed_input], outputs=gr.Textbox())
201
+
202
+ download_from_vimeo_btn = gr.Button("Download from Vimeo")
203
+ download_from_vimeo_btn.click(download_from_vimeo, inputs=url_input, outputs=gr.Textbox())
204
+
205
+ download_from_facebook_btn = gr.Button("Download from Facebook")
206
+ download_from_facebook_btn.click(download_from_facebook, inputs=url_input, outputs=gr.Textbox())
207
+
208
+ download_from_instagram_btn = gr.Button("Download from Instagram")
209
+ download_from_instagram_btn.click(download_from_instagram, inputs=url_input, outputs=gr.Textbox())
210
+
211
+ download_from_twitter_btn = gr.Button("Download from Twitter")
212
+ download_from_twitter_btn.click(download_from_twitter, inputs=url_input, outputs=gr.Textbox())
213
+
214
+ download_from_tiktok_btn = gr.Button("Download from TikTok")
215
+ download_from_tiktok_btn.click(download_from_tiktok, inputs=url_input, outputs=gr.Textbox())
216
+
217
+ download_from_reddit_btn = gr.Button("Download from Reddit")
218
+ download_from_reddit_btn.click(download_from_reddit, inputs=url_input, outputs=gr.Textbox())
219
+
220
+ download_from_dailymotion_btn = gr.Button("Download from Dailymotion")
221
+ download_from_dailymotion_btn.click(download_from_dailymotion, inputs=url_input, outputs=gr.Textbox())
222
+
223
+ download_youtube_transcript_as_text_btn = gr.Button("Download YouTube Transcript as Text")
224
+ download_youtube_transcript_as_text_btn.click(download_youtube_transcript_as_text, inputs=url_input, outputs=gr.Textbox())
225
+
226
+ download_youtube_transcript_as_markdown_btn = gr.Button("Download YouTube Transcript as Markdown")
227
+ download_youtube_transcript_as_markdown_btn.click(download_youtube_transcript_as_markdown, inputs=url_input, outputs=gr.Textbox())
228
+
229
+ download_video_info_and_save_as_json_btn = gr.Button("Download Video Info and Save as JSON")
230
+ download_video_info_and_save_as_json_btn.click(download_video_info_and_save_as_json, inputs=url_input, outputs=gr.Textbox())
231
+
232
+ list_available_formats_without_downloading_btn = gr.Button("List Available Formats without Downloading")
233
+ list_available_formats_without_downloading_btn.click(list_available_formats_without_downloading, inputs=url_input, outputs=gr.Textbox())
234
+
235
+ username_input = gr.Textbox(label="YouTube Username")
236
+ password_input = gr.Textbox(label="YouTube Password", type="password")
237
+ download_from_youtube_age_restricted_content_btn = gr.Button("Download from YouTube Age-Restricted Content")
238
+ download_from_youtube_age_restricted_content_btn.click(download_from_youtube_age_restricted_content, inputs=[url_input, username_input, password_input], outputs=gr.Textbox())
239
+
240
+ with gr.Tab("SoundCloud Commands"):
241
+ with gr.Row():
242
+ with gr.Column():
243
+ soundcloud_url_input = gr.Textbox(label="SoundCloud URL")
244
+ list_soundcloud_formats_btn = gr.Button("List Available Formats")
245
+ list_soundcloud_formats_btn.click(list_available_formats, inputs=soundcloud_url_input, outputs=gr.Textbox())
246
+
247
+ download_hq_mp3_from_soundcloud_btn = gr.Button("Download High-Quality MP3 from SoundCloud")
248
+ download_hq_mp3_from_soundcloud_btn.click(download_hq_from_soundcloud, inputs=soundcloud_url_input, outputs=gr.Textbox())
249
+
250
+ download_hq_with_metadata_from_soundcloud_btn = gr.Button("Download HQ with Metadata from SoundCloud")
251
+ download_hq_with_metadata_from_soundcloud_btn.click(download_and_add_metadata_tags, inputs=soundcloud_url_input, outputs=gr.Textbox())
252
+
253
+ download_entire_playlist_from_soundcloud_btn = gr.Button("Download Entire Playlist from SoundCloud")
254
+ download_entire_playlist_from_soundcloud_btn.click(download_entire_playlist, inputs=soundcloud_url_input, outputs=gr.Textbox())
255
+
256
+ download_entire_playlist_with_metadata_from_soundcloud_btn = gr.Button("Download Entire Playlist from SoundCloud with Metadata")
257
+ download_entire_playlist_with_metadata_from_soundcloud_btn.click(download_and_add_metadata_tags, inputs=soundcloud_url_input, outputs=gr.Textbox())
258
+
259
+ multiple_playlists_input = gr.Textbox(label="Multiple Playlist URLs (space-separated)")
260
+ download_multiple_playlists_with_metadata_btn = gr.Button("Download Multiple Playlists with Metadata")
261
+ download_multiple_playlists_with_metadata_btn.click(download_multiple_individual_files, inputs=multiple_playlists_input, outputs=gr.Textbox())
262
+
263
+ playlist_range_start_input_soundcloud = gr.Textbox(label="Start Index")
264
+ playlist_range_end_input_soundcloud = gr.Textbox(label="End Index")
265
+ download_playlist_with_specific_range_btn = gr.Button("Download Playlist with Specific Range")
266
+ download_playlist_with_specific_range_btn.click(download_playlist_specific_range, inputs=[soundcloud_url_input, playlist_range_start_input_soundcloud, playlist_range_end_input_soundcloud], outputs=gr.Textbox())
267
+
268
+ embed_album_art_soundcloud_btn = gr.Button("Download and Embed Album Art")
269
+ embed_album_art_soundcloud_btn.click(embed_album_art_automatically, inputs=soundcloud_url_input, outputs=gr.Textbox())
270
+
271
+ skip_downloaded_soundcloud_files_btn = gr.Button("Skip Downloading Already Downloaded SoundCloud Files")
272
+ skip_downloaded_soundcloud_files_btn.click(skip_already_downloaded_files, inputs=soundcloud_url_input, outputs=gr.Textbox())
273
+
274
+ multiple_tracks_input = gr.Textbox(label="Multiple Track URLs (space-separated)")
275
+ download_multiple_tracks_from_soundcloud_btn = gr.Button("Download Multiple Tracks from SoundCloud")
276
+ download_multiple_tracks_from_soundcloud_btn.click(download_multiple_individual_files, inputs=multiple_tracks_input, outputs=gr.Textbox())
277
+
278
+ download_speed_soundcloud_input = gr.Textbox(label="Download Speed (e.g., 1M)")
279
+ limit_download_speed_for_soundcloud_btn = gr.Button("Limit Download Speed for SoundCloud")
280
+ limit_download_speed_for_soundcloud_btn.click(download_and_limit_download_speed, inputs=[soundcloud_url_input, download_speed_soundcloud_input], outputs=gr.Textbox())
281
+
282
+ split_by_chapters_soundcloud_btn = gr.Button("Download and Split by Chapters (if available)")
283
+ split_by_chapters_soundcloud_btn.click(download_and_split_by_chapters, inputs=soundcloud_url_input, outputs=gr.Textbox())
284
+
285
+ start_time_soundcloud_input = gr.Textbox(label="Start Time (e.g., 00:01:00)")
286
+ end_time_soundcloud_input = gr.Textbox(label="End Time (e.g., 00:05:00)")
287
+ extract_portion_of_soundcloud_track_btn = gr.Button("Download SoundCloud Track and Extract a Specific Portion")
288
+ extract_portion_of_soundcloud_track_btn.click(extract_portion_of_video, inputs=[soundcloud_url_input, start_time_soundcloud_input, end_time_soundcloud_input], outputs=gr.Textbox())
289
+
290
+ update_metadata_of_existing_soundcloud_downloads_btn = gr.Button("Update Metadata of Existing SoundCloud Downloads")
291
+ update_metadata_of_existing_soundcloud_downloads_btn.click(update_metadata_of_existing_files, inputs=soundcloud_url_input, outputs=gr.Textbox())
292
+
293
+ auto_rename_duplicate_soundcloud_files_btn = gr.Button("Auto-Rename Duplicate SoundCloud Files")
294
+ auto_rename_duplicate_soundcloud_files_btn.click(auto_rename_duplicate_files, inputs=soundcloud_url_input, outputs=gr.Textbox())
295
+
296
+ soundcloud_url_list_file_input = gr.Textbox(label="SoundCloud URL List File Path")
297
+ download_from_soundcloud_url_list_file_btn = gr.Button("Download from SoundCloud URL List File")
298
+ download_from_soundcloud_url_list_file_btn.click(download_from_url_list_file, inputs=soundcloud_url_list_file_input, outputs=gr.Textbox())
299
 
300
  demo.launch()