SteveDigital commited on
Commit
129b6dc
1 Parent(s): 8553442

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -10,13 +10,16 @@ summarizer = pipeline("summarization")
10
 
11
  def get_audio(url):
12
  yt = YouTube(url)
13
- video = yt.streams.filter(only_audio=True).first()
14
- out_file=video.download(output_path=".")
15
- base, ext = os.path.splitext(out_file)
16
- new_file = base+'.mp3'
17
- os.rename(out_file, new_file)
18
- a = new_file
19
- return a
 
 
 
20
 
21
  def get_text(url):
22
  if url != '' : output_text_transcribe = ''
 
10
 
11
  def get_audio(url):
12
  yt = YouTube(url)
13
+ if yt.length < 540:
14
+ video = yt.streams.filter(only_audio=True).first()
15
+ out_file=video.download(output_path=".")
16
+ base, ext = os.path.splitext(out_file)
17
+ new_file = base+'.mp3'
18
+ os.rename(out_file, new_file)
19
+ a = new_file
20
+ return a
21
+ else:
22
+ return ""
23
 
24
  def get_text(url):
25
  if url != '' : output_text_transcribe = ''