Spaces:
Build error
Build error
Paul Ke commited on
Update streamlit_app.py
Browse files- streamlit_app.py +7 -30
streamlit_app.py
CHANGED
|
@@ -101,9 +101,6 @@ def download_video(url: str, save_path: str, **kwargs):
|
|
| 101 |
ydl_opts[opt] = kwargs[opt]
|
| 102 |
print(ydl_opts)
|
| 103 |
|
| 104 |
-
if st.session_state["ig_cookie"]:
|
| 105 |
-
ydl_opts["cookies"] = st.session_state["ig_cookie"]
|
| 106 |
-
|
| 107 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 108 |
ydl.download(url)
|
| 109 |
|
|
@@ -130,34 +127,14 @@ def convert_video_to_mp4(video_path):
|
|
| 130 |
|
| 131 |
# --- Streamlit App ---
|
| 132 |
|
| 133 |
-
st.title("Download Any* Video")
|
| 134 |
-
|
| 135 |
-
# Side bar content
|
| 136 |
-
with st.sidebar:
|
| 137 |
-
st.subheader("Cookies! :cookie:")
|
| 138 |
-
st.write(
|
| 139 |
-
"For some websites that have a more strict bot control it's necessary to upload a cookie file to download content from them"
|
| 140 |
-
)
|
| 141 |
-
st.file_uploader(
|
| 142 |
-
label="**Upload Instagram Cookie** :cookie:",
|
| 143 |
-
type=["txt", "json"],
|
| 144 |
-
accept_multiple_files=False,
|
| 145 |
-
key="ig_cookie",
|
| 146 |
-
)
|
| 147 |
-
st.file_uploader(
|
| 148 |
-
label="**Upload TikTok Cookie** :cookie:",
|
| 149 |
-
type=["txt", "json"],
|
| 150 |
-
accept_multiple_files=False,
|
| 151 |
-
key="tt_cookie",
|
| 152 |
-
)
|
| 153 |
-
st.button(
|
| 154 |
-
"Clear Videos",
|
| 155 |
-
on_click=_remove_all_videos,
|
| 156 |
-
type="secondary",
|
| 157 |
-
help="Clear all downloaded videos",
|
| 158 |
-
)
|
| 159 |
-
|
| 160 |
# Main content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
st.text_input(
|
| 162 |
"Video URL",
|
| 163 |
key="url",
|
|
|
|
| 101 |
ydl_opts[opt] = kwargs[opt]
|
| 102 |
print(ydl_opts)
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 105 |
ydl.download(url)
|
| 106 |
|
|
|
|
| 127 |
|
| 128 |
# --- Streamlit App ---
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
# Main content
|
| 131 |
+
st.button(
|
| 132 |
+
"Clear Videos",
|
| 133 |
+
on_click=_remove_all_videos,
|
| 134 |
+
type="secondary",
|
| 135 |
+
help="Clear all downloaded videos",
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
st.text_input(
|
| 139 |
"Video URL",
|
| 140 |
key="url",
|