Update app.py
Browse files
app.py
CHANGED
|
@@ -33,16 +33,16 @@ def extract_yt_audio(it, video_url, video_file):
|
|
| 33 |
a = yt.streams.filter(only_audio=True).first()
|
| 34 |
audio_file = a.download()
|
| 35 |
sample = AudioSegment.from_file(audio_file, format="mp4")
|
| 36 |
-
elif it == 'URL' and ("https://www" in video_url or "https://" in video_url or "www." in video_url):
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
elif it == 'URL':
|
| 47 |
sample = AudioSegment.from_file(video_url)
|
| 48 |
else:
|
|
|
|
| 33 |
a = yt.streams.filter(only_audio=True).first()
|
| 34 |
audio_file = a.download()
|
| 35 |
sample = AudioSegment.from_file(audio_file, format="mp4")
|
| 36 |
+
# elif it == 'URL' and ("https://www" in video_url or "https://" in video_url or "www." in video_url):
|
| 37 |
+
# response = requests.get(video_url)
|
| 38 |
+
# with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as temp_file:
|
| 39 |
+
# temp_file.write(response.content)
|
| 40 |
+
# temp_file_path = temp_file.name
|
| 41 |
+
# wav_file_path = temp_file_path.replace(".mp4", ".wav")
|
| 42 |
+
# subprocess.run(["ffmpeg", "-i", temp_file_path, "-vn", "-acodec", "pcm_s16le", "-ar", "44100", "-ac", "2", wav_file_path], check=True)
|
| 43 |
+
# sample = AudioSegment.from_wav(wav_file_path)
|
| 44 |
+
# os.remove(temp_file_path)
|
| 45 |
+
# os.remove(wav_file_path)
|
| 46 |
elif it == 'URL':
|
| 47 |
sample = AudioSegment.from_file(video_url)
|
| 48 |
else:
|