Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from instascraper import Post
|
3 |
+
|
4 |
+
hide_streamlit_style = """
|
5 |
+
<style>
|
6 |
+
#MainMenu {visibility: hidden;}
|
7 |
+
footer {visibility: hidden;}
|
8 |
+
|
9 |
+
.stApp{
|
10 |
+
background-image: linear-gradient(115deg,#FFAF00,#FFC500,#FFD600,#FCED00,#F9F380,#F6F7CD);
|
11 |
+
animation: rotate 7s linear infinite;
|
12 |
+
}
|
13 |
+
@keyframes rotate {
|
14 |
+
100%{
|
15 |
+
filter: hue-rotate(-360deg)
|
16 |
+
}
|
17 |
+
}
|
18 |
+
</style>
|
19 |
+
"""
|
20 |
+
|
21 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
22 |
+
|
23 |
+
class InstagramDownloader:
|
24 |
+
@staticmethod
|
25 |
+
def run():
|
26 |
+
st.header("")
|
27 |
+
post_url = st.text_input("Enter Instagram post URL")
|
28 |
+
start_button = st.button("Start")
|
29 |
+
|
30 |
+
if start_button:
|
31 |
+
if post_url:
|
32 |
+
InstagramDownloader.download_video(post_url)
|
33 |
+
InstagramDownloader.helper_message()
|
34 |
+
|
35 |
+
st.markdown("")
|
36 |
+
|
37 |
+
@staticmethod
|
38 |
+
def download_video(post_url):
|
39 |
+
post = Post(post_url)
|
40 |
+
video_url = post.video_url
|
41 |
+
|
42 |
+
with st.spinner("Downloading..."):
|
43 |
+
# Perform your download logic here using the video_url
|
44 |
+
# For example, you can use requests library to download the video content
|
45 |
+
# Ensure you handle the download process appropriately
|
46 |
+
# Here's a placeholder for demonstration purposes:
|
47 |
+
st.success("Downloaded")
|
48 |
+
|
49 |
+
@classmethod
|
50 |
+
def helper_message(cls):
|
51 |
+
st.write(
|
52 |
+
"> To save to the local computer, "
|
53 |
+
"click the vertical ... icon (aka hamburger button) in the bottom-right corner (in the video above) and click download."
|
54 |
+
)
|
55 |
+
|
56 |
+
if __name__ == "__main__":
|
57 |
+
InstagramDownloader.run()
|