File size: 1,601 Bytes
607f2cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import streamlit as st
from instascraper import Post

hide_streamlit_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}

.stApp{
background-image: linear-gradient(115deg,#FFAF00,#FFC500,#FFD600,#FCED00,#F9F380,#F6F7CD);
  animation: rotate 7s linear infinite;
}
@keyframes rotate {
  100%{
    filter: hue-rotate(-360deg)
  }
}
</style>
"""

st.markdown(hide_streamlit_style, unsafe_allow_html=True)

class InstagramDownloader:
    @staticmethod
    def run():
        st.header("")
        post_url = st.text_input("Enter Instagram post URL")
        start_button = st.button("Start")

        if start_button:
            if post_url:
                InstagramDownloader.download_video(post_url)
                InstagramDownloader.helper_message()

        st.markdown("")

    @staticmethod
    def download_video(post_url):
        post = Post(post_url)
        video_url = post.video_url

        with st.spinner("Downloading..."):
            # Perform your download logic here using the video_url
            # For example, you can use requests library to download the video content
            # Ensure you handle the download process appropriately
            # Here's a placeholder for demonstration purposes:
            st.success("Downloaded")

    @classmethod
    def helper_message(cls):
        st.write(
            "> To save to the local computer, "
            "click the vertical ... icon (aka hamburger button) in the bottom-right corner (in the video above) and click download."
        )

if __name__ == "__main__":
    InstagramDownloader.run()