Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from extract import
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def main():
|
|
@@ -18,23 +18,28 @@ def main():
|
|
| 18 |
# Aplicar el id al título para que se aplique el estilo CSS
|
| 19 |
st.title("PyCARO", anchor="pycaro")
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
if st.button("🔎"):
|
| 24 |
-
if not
|
| 25 |
st.warning("No has introducido ninguna URL")
|
| 26 |
else:
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
-
def visualize(
|
| 31 |
try:
|
| 32 |
# Fetch and display the website content
|
| 33 |
with st.spinner("Loading website data..."):
|
| 34 |
-
data =
|
| 35 |
|
| 36 |
if data:
|
| 37 |
-
st.subheader(f"Resultados para {
|
| 38 |
df = pd.DataFrame(data)
|
| 39 |
st.table(df)
|
| 40 |
else:
|
|
@@ -45,4 +50,4 @@ def visualize(domain_url):
|
|
| 45 |
st.error(f"Error: {e}")
|
| 46 |
|
| 47 |
if __name__ == "__main__":
|
| 48 |
-
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from extract import extract_data
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def main():
|
|
|
|
| 18 |
# Aplicar el id al título para que se aplique el estilo CSS
|
| 19 |
st.title("PyCARO", anchor="pycaro")
|
| 20 |
|
| 21 |
+
# Selector de tipo de búsqueda
|
| 22 |
+
search_type = st.selectbox("Selecciona el tipo de búsqueda:", ["Dominio", "URL"])
|
| 23 |
+
|
| 24 |
+
# Obtener la URL del dominio o la URL del input del usuario
|
| 25 |
+
input_label = "Introduce la URL del dominio ▶" if search_type == "Dominio" else "Introduce la URL ▶"
|
| 26 |
+
user_input = st.text_input(input_label, "")
|
| 27 |
+
|
| 28 |
if st.button("🔎"):
|
| 29 |
+
if not user_input:
|
| 30 |
st.warning("No has introducido ninguna URL")
|
| 31 |
else:
|
| 32 |
+
mode = "domain" if search_type == "Dominio" else "url"
|
| 33 |
+
visualize(user_input, mode)
|
| 34 |
|
| 35 |
+
def visualize(user_input, mode):
|
| 36 |
try:
|
| 37 |
# Fetch and display the website content
|
| 38 |
with st.spinner("Loading website data..."):
|
| 39 |
+
data = extract_data(user_input, mode)
|
| 40 |
|
| 41 |
if data:
|
| 42 |
+
st.subheader(f"Resultados para {user_input}:")
|
| 43 |
df = pd.DataFrame(data)
|
| 44 |
st.table(df)
|
| 45 |
else:
|
|
|
|
| 50 |
st.error(f"Error: {e}")
|
| 51 |
|
| 52 |
if __name__ == "__main__":
|
| 53 |
+
main()
|