Skip to content

Commit

Permalink
Update transcribe_translate.py
Browse files Browse the repository at this point in the history
Realized it would be quicker to only pull audio from the onset, versus locating just the audio portion of a video stream
  • Loading branch information
gorgarp authored Jun 2, 2024
1 parent 339e475 commit ead5c39
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions transcribe_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ def fetch_stream_metadata(access_token, channel_name):
# Get the stream URL using streamlink
def get_stream_url(channel_name):
streams = streamlink.streams(f"https://www.twitch.tv/{channel_name}")
if "best" in streams:
if "audio_only" in streams:
return streams["audio_only"].url
elif "best" in streams:
return streams["best"].url
else:
raise Exception("No 'best' quality stream found.")
raise Exception("No suitable stream found.")

# Transcribe streaming audio using Whisper
def transcribe_audio_stream(audio_stream):
Expand Down

0 comments on commit ead5c39

Please sign in to comment.