File size: 2,468 Bytes
b6e91ad 6721635 c8849a2 b6e91ad da449d7 70f6c2c 01128b6 5d4012d f4e4e3e 5d4012d 8f77262 e10447c da449d7 5d4012d 31cacf9 3dde32f 0fb5d6e 70f6c2c b6e91ad 6721635 78ce7a3 6721635 e948e35 6721635 2480a37 6721635 4a22f15 b6e91ad 6721635 b6e91ad 6721635 b6e91ad 6e72c1a 78ce7a3 6721635 c8849a2 4a22f15 e948e35 4a22f15 4a49043 da449d7 4a49043 da449d7 b6e91ad 4a22f15 dc9fb5d b6e91ad 2444357 | 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | import streamlit as st
from extract import extract_data
import pandas as pd
def main():
# Definir el estilo CSS
css = """
<style>
h1#pycaro {
text-align: center;
color: #f85149;
}
h3 {
color: #df6f6a;
font-weight: 100;
font-style: italic;
font-size: large;
}
h3 a {
color: white;
font-weight: 100;
font-style: italic;
font-size: large;
}
td:nth-child(1) {
white-space: nowrap;
}
th {
text-align: left;
font-weight: 300;
color: #df6f6a;
}
table {
width: 100%;
border-collapse: collapse;
}
</style>
"""
# Inyectar el estilo CSS en la aplicaci贸n
st.markdown(css, unsafe_allow_html=True)
# Aplicar el id al t铆tulo para que se aplique el estilo CSS
st.title("PyCARO", anchor="pycaro")
# Selector de tipo de b煤squeda
search_type = st.selectbox("Selecciona el tipo de b煤squeda", ["Dominio", "URL"])
# Obtener la URL del dominio o la URL del input del usuario
input_label = "Introduce la URL del dominio" if search_type == "Dominio" else "Introduce la URL"
user_input = st.text_input(input_label, "")
if st.button("馃攷"):
if not user_input:
st.warning("No has introducido ninguna URL")
else:
mode = "domain" if search_type == "Dominio" else "url"
visualize(user_input, mode)
def visualize(user_input, mode):
try:
# Fetch and display the website content
with st.spinner("Cargando datos del sitio web ..."):
data = extract_data(user_input, mode)
if data:
st.subheader(f"Resultados para {user_input}")
df = pd.DataFrame(data)
# Eliminar la columna "脷ltima actualizaci贸n" si existe
if "脷ltima actualizaci贸n" in df.columns:
df = df.drop(columns=["脷ltima actualizaci贸n"])
# Convertir el DataFrame a HTML y ocultar la columna de 铆ndice
html_table = df.to_html(index=False, escape=False, border=0)
st.markdown(html_table, unsafe_allow_html=True)
else:
st.error("No se encontraron datos")
except Exception as e:
st.error(f"Error: {e}")
if __name__ == "__main__":
main() |