Spaces:
Sleeping
Sleeping
Matias Macias Gomez commited on
Commit ·
2c035b6
1
Parent(s): 630dd9d
update to add video password options
Browse files- streamlit_app.py +10 -1
streamlit_app.py
CHANGED
|
@@ -49,6 +49,9 @@ def download_video(url: str, save_path: str, **kwargs):
|
|
| 49 |
ydl_opts = {
|
| 50 |
"outtmpl": f"{save_path}/{video_id}.%(ext)s",
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
if st.session_state["ig_cookie"]:
|
| 54 |
ydl_opts["cookies"] = st.session_state["ig_cookie"]
|
|
@@ -114,11 +117,17 @@ st.text_input(
|
|
| 114 |
on_change=_remove_video,
|
| 115 |
)
|
| 116 |
|
|
|
|
|
|
|
|
|
|
| 117 |
if st.session_state["url"]:
|
| 118 |
download = st.button("Load Video")
|
| 119 |
if download:
|
|
|
|
|
|
|
|
|
|
| 120 |
video_path = download_video(
|
| 121 |
-
st.session_state["url"], save_path=os.path.join(".", "data")
|
| 122 |
)
|
| 123 |
st.session_state["videos"] = video_path
|
| 124 |
|
|
|
|
| 49 |
ydl_opts = {
|
| 50 |
"outtmpl": f"{save_path}/{video_id}.%(ext)s",
|
| 51 |
}
|
| 52 |
+
for opt in kwargs.keys():
|
| 53 |
+
ydl_opts[opt] = kwargs[opt]
|
| 54 |
+
print(ydl_opts)
|
| 55 |
|
| 56 |
if st.session_state["ig_cookie"]:
|
| 57 |
ydl_opts["cookies"] = st.session_state["ig_cookie"]
|
|
|
|
| 117 |
on_change=_remove_video,
|
| 118 |
)
|
| 119 |
|
| 120 |
+
with st.expander("Options", expanded=False):
|
| 121 |
+
st.text_input("Video Password", key="video-password", placeholder="Enter Video Password")
|
| 122 |
+
|
| 123 |
if st.session_state["url"]:
|
| 124 |
download = st.button("Load Video")
|
| 125 |
if download:
|
| 126 |
+
download_options = {}
|
| 127 |
+
if st.session_state["video-password"]:
|
| 128 |
+
download_options["videopassword"] = st.session_state["video-password"]
|
| 129 |
video_path = download_video(
|
| 130 |
+
st.session_state["url"], save_path=os.path.join(".", "data"), **download_options
|
| 131 |
)
|
| 132 |
st.session_state["videos"] = video_path
|
| 133 |
|