Update app.py
Browse files
app.py
CHANGED
@@ -34,9 +34,15 @@ confetti_animation_script = """
|
|
34 |
function randomInRange(min, max) {
|
35 |
return Math.random() * (max - min) + min;
|
36 |
}
|
|
|
|
|
|
|
|
|
37 |
</script>
|
38 |
"""
|
39 |
|
|
|
|
|
40 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
41 |
|
42 |
class YouTubeDownloader:
|
@@ -44,7 +50,7 @@ class YouTubeDownloader:
|
|
44 |
def run():
|
45 |
st.header("")
|
46 |
url = st.text_input("Enter Here")
|
47 |
-
start_button = st.button("Start")
|
48 |
|
49 |
if start_button:
|
50 |
if url:
|
@@ -56,9 +62,6 @@ class YouTubeDownloader:
|
|
56 |
st.video(file_)
|
57 |
YouTubeDownloader.helper_message()
|
58 |
|
59 |
-
# Use components.html to inject the HTML directly
|
60 |
-
components.html(confetti_animation_script, height=0)
|
61 |
-
|
62 |
st.markdown("")
|
63 |
|
64 |
@staticmethod
|
@@ -78,7 +81,7 @@ class YouTubeDownloader:
|
|
78 |
import validators
|
79 |
|
80 |
if not validators.url(url):
|
81 |
-
st.error("Hi there
|
82 |
st.stop()
|
83 |
|
84 |
@classmethod
|
@@ -97,6 +100,10 @@ class YouTubeDownloader:
|
|
97 |
"click the vertical ... icon (aka hamburger button) in the bottom-right corner (in the video above) and click download."
|
98 |
)
|
99 |
|
|
|
|
|
|
|
|
|
100 |
|
101 |
if __name__ == "__main__":
|
102 |
YouTubeDownloader.run()
|
|
|
34 |
function randomInRange(min, max) {
|
35 |
return Math.random() * (max - min) + min;
|
36 |
}
|
37 |
+
|
38 |
+
function startButtonClicked() {
|
39 |
+
triggerConfetti();
|
40 |
+
}
|
41 |
</script>
|
42 |
"""
|
43 |
|
44 |
+
components.html(confetti_animation_script)
|
45 |
+
|
46 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
47 |
|
48 |
class YouTubeDownloader:
|
|
|
50 |
def run():
|
51 |
st.header("")
|
52 |
url = st.text_input("Enter Here")
|
53 |
+
start_button = st.button("Start", on_click=YouTubeDownloader.start_button_clicked)
|
54 |
|
55 |
if start_button:
|
56 |
if url:
|
|
|
62 |
st.video(file_)
|
63 |
YouTubeDownloader.helper_message()
|
64 |
|
|
|
|
|
|
|
65 |
st.markdown("")
|
66 |
|
67 |
@staticmethod
|
|
|
81 |
import validators
|
82 |
|
83 |
if not validators.url(url):
|
84 |
+
st.error("Hi there ð URL seems invalid ð½")
|
85 |
st.stop()
|
86 |
|
87 |
@classmethod
|
|
|
100 |
"click the vertical ... icon (aka hamburger button) in the bottom-right corner (in the video above) and click download."
|
101 |
)
|
102 |
|
103 |
+
@classmethod
|
104 |
+
def start_button_clicked(cls):
|
105 |
+
YouTubeDownloader.trigger_confetti()
|
106 |
+
|
107 |
|
108 |
if __name__ == "__main__":
|
109 |
YouTubeDownloader.run()
|