import streamlit as st from youtube_transcript_api import YouTubeTranscriptApi import urllib.parse as urlparse from pytube import extract transcript = "" def read_file(_id): tx = YouTubeTranscriptApi.get_transcript(_id) my_list = [] for i in tx: curr_str = i["text"].replace("\xa0", "").replace("\n", " ") my_list.append(curr_str) transcript = " ".join(str(x) for x in my_list) st.markdown(transcript) st.title('Easily transcribe YouTube videos') link = st.text_input('Enter your YouTube video link', 'https://www.youtube.com/watch?v=WzBt4VJzfUI') if link is not None: print(link) _id=extract.video_id(link) st.video(link) st.button('check_status', on_click=read_file(_id))