Spaces:
Runtime error
Runtime error
Commit
•
59772fd
1
Parent(s):
068d9cf
Upload 2 files
Browse files- app.py +36 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from youtube_transcript_api import YouTubeTranscriptApi
|
3 |
+
import urllib.parse as urlparse
|
4 |
+
from pytube import extract
|
5 |
+
|
6 |
+
transcript = ""
|
7 |
+
|
8 |
+
|
9 |
+
def read_file(_id):
|
10 |
+
tx = YouTubeTranscriptApi.get_transcript(_id)
|
11 |
+
my_list = []
|
12 |
+
for i in tx:
|
13 |
+
curr_str = i["text"].replace("\xa0", "").replace("\n", " ")
|
14 |
+
my_list.append(curr_str)
|
15 |
+
transcript = " ".join(str(x) for x in my_list)
|
16 |
+
st.markdown(transcript)
|
17 |
+
|
18 |
+
st.title('Easily transcribe YouTube videos')
|
19 |
+
|
20 |
+
link = st.text_input('Enter your YouTube video link', 'https://www.youtube.com/watch?v=WzBt4VJzfUI')
|
21 |
+
|
22 |
+
if link is not None:
|
23 |
+
print(link)
|
24 |
+
_id=extract.video_id(link)
|
25 |
+
st.video(link)
|
26 |
+
|
27 |
+
st.button('check_status', on_click=read_file(_id))
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
youtube_transcript_api
|
3 |
+
pytube
|