Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import streamlit as st
 
2
  from extract import take_webdata
3
  from PIL import Image
4
  from io import BytesIO
5
 
6
  def main():
7
- st.title("Website Content Exctractor")
8
 
9
  # Get website URL from user input
10
  url = st.text_input("Enter a URL:", "")
@@ -17,26 +18,28 @@ def main():
17
 
18
  def visualize(url):
19
  try:
20
- # Fetch and display the website content
21
- with st.spinner("loading website data ..."):
22
- # innerHTML = get_innerHTML(url)
 
 
23
  html_image, html_content = take_webdata(url)
24
- st.subheader("Website title:")
 
25
  if html_content:
26
  st.info(html_content)
27
  else:
28
- st.error("Error: empty html content")
29
- st.subheader("Website preview:")
 
30
  if html_image:
31
  st.image(html_image)
32
  else:
33
- st.error("Error: empty html preview")
34
-
35
 
36
  except Exception as e:
37
  st.error(f"Error: {e}")
38
 
39
 
40
-
41
  if __name__ == "__main__":
42
- main()
 
1
  import streamlit as st
2
+ import time
3
  from extract import take_webdata
4
  from PIL import Image
5
  from io import BytesIO
6
 
7
  def main():
8
+ st.title("Website Content Extractor")
9
 
10
  # Get website URL from user input
11
  url = st.text_input("Enter a URL:", "")
 
18
 
19
  def visualize(url):
20
  try:
21
+ # Add a 10-second delay before fetching the website data
22
+ with st.spinner("Loading website data... Please wait..."):
23
+ time.sleep(10) # Wait for 10 seconds before proceeding
24
+
25
+ # Fetch and display the website content
26
  html_image, html_content = take_webdata(url)
27
+
28
+ st.subheader("Website Title:")
29
  if html_content:
30
  st.info(html_content)
31
  else:
32
+ st.error("Error: empty HTML content.")
33
+
34
+ st.subheader("Website Preview:")
35
  if html_image:
36
  st.image(html_image)
37
  else:
38
+ st.error("Error: empty HTML preview.")
 
39
 
40
  except Exception as e:
41
  st.error(f"Error: {e}")
42
 
43
 
 
44
  if __name__ == "__main__":
45
+ main()