Update app.py
Browse files
app.py
CHANGED
|
@@ -1,40 +1,25 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import
|
| 3 |
-
import time
|
| 4 |
-
from PIL import Image
|
| 5 |
-
from io import BytesIO
|
| 6 |
-
|
| 7 |
-
def download_instagram_image(link):
|
| 8 |
-
response = requests.get(link)
|
| 9 |
-
|
| 10 |
-
if response.status_code == 200:
|
| 11 |
-
data = response.json()
|
| 12 |
-
img_url = data["graphql"]["shortcode_media"]["display_url"]
|
| 13 |
-
|
| 14 |
-
img_response = requests.get(img_url)
|
| 15 |
-
img_data = BytesIO(img_response.content)
|
| 16 |
-
|
| 17 |
-
image = Image.open(img_data)
|
| 18 |
-
image.save(f"instagram_{int(time.time())}.png")
|
| 19 |
-
st.success('Image downloaded successfully!')
|
| 20 |
-
else:
|
| 21 |
-
st.error('Error fetching Instagram data. Please check the provided URL.')
|
| 22 |
|
| 23 |
def main():
|
| 24 |
-
st.title("Instagram
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
# Input field for
|
| 27 |
-
|
| 28 |
|
| 29 |
# Button to trigger the download
|
| 30 |
-
if st.button("Download
|
| 31 |
-
if link:
|
| 32 |
try:
|
| 33 |
-
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
st.error(f"Error: {str(e)}")
|
| 36 |
else:
|
| 37 |
-
st.warning("Please enter
|
| 38 |
|
| 39 |
if __name__ == "__main__":
|
| 40 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from insta_reels.reels_downloader import download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
def main():
|
| 5 |
+
st.title("Instagram Reels Downloader")
|
| 6 |
+
|
| 7 |
+
# Input field for Instagram Reels link
|
| 8 |
+
link = st.text_input("Enter Instagram Reels Link:")
|
| 9 |
|
| 10 |
+
# Input field for output path
|
| 11 |
+
output_path = st.text_input("Enter Output Path (e.g., videos/video.mp4):")
|
| 12 |
|
| 13 |
# Button to trigger the download
|
| 14 |
+
if st.button("Download Reels"):
|
| 15 |
+
if link and output_path:
|
| 16 |
try:
|
| 17 |
+
download(link, output_path)
|
| 18 |
+
st.success("Reels downloaded successfully!")
|
| 19 |
except Exception as e:
|
| 20 |
st.error(f"Error: {str(e)}")
|
| 21 |
else:
|
| 22 |
+
st.warning("Please enter valid Instagram Reels link and output path.")
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
main()
|