Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,18 @@
|
|
| 1 |
-
# streamlit_instaloader_link.py
|
| 2 |
import streamlit as st
|
| 3 |
import instaloader
|
| 4 |
import os
|
| 5 |
from pathlib import Path
|
| 6 |
import base64
|
| 7 |
|
| 8 |
-
def download_reel_from_link(link):
|
| 9 |
L = instaloader.Instaloader()
|
| 10 |
download_dir = "downloaded_reels"
|
| 11 |
Path(download_dir).mkdir(exist_ok=True)
|
| 12 |
|
| 13 |
try:
|
|
|
|
|
|
|
|
|
|
| 14 |
# Extract shortcode from the link
|
| 15 |
shortcode = link.split('/')[-2]
|
| 16 |
|
|
@@ -35,18 +37,21 @@ def get_download_link(file_path):
|
|
| 35 |
|
| 36 |
def main():
|
| 37 |
st.title("Instagram Reel Downloader")
|
| 38 |
-
st.write("Enter the Instagram reel link to download:")
|
| 39 |
|
| 40 |
link = st.text_input("Instagram Reel Link", "")
|
|
|
|
|
|
|
|
|
|
| 41 |
if st.button("Download Reel"):
|
| 42 |
-
if link:
|
| 43 |
st.info(f"Downloading reel from {link}...")
|
| 44 |
-
reel_path = download_reel_from_link(link)
|
| 45 |
if reel_path:
|
| 46 |
st.success(f"Downloaded reel: {Path(reel_path).name}")
|
| 47 |
st.markdown(get_download_link(reel_path), unsafe_allow_html=True)
|
| 48 |
else:
|
| 49 |
-
st.warning("Please enter a valid Instagram reel link.")
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
main()
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import instaloader
|
| 3 |
import os
|
| 4 |
from pathlib import Path
|
| 5 |
import base64
|
| 6 |
|
| 7 |
+
def download_reel_from_link(link, username, password):
|
| 8 |
L = instaloader.Instaloader()
|
| 9 |
download_dir = "downloaded_reels"
|
| 10 |
Path(download_dir).mkdir(exist_ok=True)
|
| 11 |
|
| 12 |
try:
|
| 13 |
+
# Login
|
| 14 |
+
L.login(username, password)
|
| 15 |
+
|
| 16 |
# Extract shortcode from the link
|
| 17 |
shortcode = link.split('/')[-2]
|
| 18 |
|
|
|
|
| 37 |
|
| 38 |
def main():
|
| 39 |
st.title("Instagram Reel Downloader")
|
| 40 |
+
st.write("Enter the Instagram reel link and your login details to download:")
|
| 41 |
|
| 42 |
link = st.text_input("Instagram Reel Link", "")
|
| 43 |
+
username = st.text_input("Instagram Username", "")
|
| 44 |
+
password = st.text_input("Instagram Password", type="password")
|
| 45 |
+
|
| 46 |
if st.button("Download Reel"):
|
| 47 |
+
if link and username and password:
|
| 48 |
st.info(f"Downloading reel from {link}...")
|
| 49 |
+
reel_path = download_reel_from_link(link, username, password)
|
| 50 |
if reel_path:
|
| 51 |
st.success(f"Downloaded reel: {Path(reel_path).name}")
|
| 52 |
st.markdown(get_download_link(reel_path), unsafe_allow_html=True)
|
| 53 |
else:
|
| 54 |
+
st.warning("Please enter a valid Instagram reel link and login details.")
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|
| 57 |
main()
|