Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def buscar_google(query, dominio, hl='es', num_results=100):
|
|
21 |
url_objetivo = dominio
|
22 |
dominio_objetivo = urlparse(url_objetivo).netloc
|
23 |
|
24 |
-
table_html = "<table border='1'><tr><th>Posici贸n</th><th>T铆tulo</th><th>URL</th></tr>"
|
25 |
|
26 |
estilo = "color: #ed4b4b;"
|
27 |
|
@@ -53,28 +53,25 @@ def buscar_google(query, dominio, hl='es', num_results=100):
|
|
53 |
|
54 |
table_html += f"<tr><td>{i+1}</td><td>{header}</td><td><span style='{estilo_dominio}'>{link_clean}</span></td></tr>"
|
55 |
|
56 |
-
table_html += "</table>"
|
57 |
|
|
|
58 |
if len(posiciones_dominio) > 1 and 1 in posiciones_dominio:
|
59 |
mensaje = f"Parasitaci贸n SEO: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃"
|
60 |
-
estilo = "font-size:19px; color: #ffd700;"
|
61 |
elif len(posiciones_dominio) > 1:
|
62 |
mensaje = f"Canibalizaci贸n: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃槙"
|
63 |
-
estilo = "font-size:19px; color: #ed4b4b;"
|
64 |
elif len(posiciones_dominio) == 1 and len(posiciones_dominio_exacto) == 0:
|
65 |
mensaje = f"Canibalizaci贸n: URL diferente del dominio en la posici贸n {posiciones_dominio[0]} 馃槙"
|
66 |
elif len(posiciones_dominio) == 1:
|
67 |
mensaje = f"Sin canibalizaci贸n: {url_objetivo} se encuentra en la posici贸n {posiciones_dominio[0]} 馃槙"
|
68 |
-
estilo = "font-size:19px; color: #26d52d;"
|
69 |
else:
|
70 |
mensaje = f"{url_objetivo} no se encuentra en el top 100 馃槙"
|
71 |
-
estilo = "font-size:19px; color: #ed4b4b;"
|
72 |
|
73 |
return mensaje, table_html
|
74 |
|
75 |
def canibalizacion_interface(url, keyword):
|
76 |
mensaje, tabla = buscar_google(keyword, url)
|
77 |
-
return mensaje, tabla
|
78 |
|
79 |
iface = gr.Interface(
|
80 |
fn=canibalizacion_interface,
|
|
|
21 |
url_objetivo = dominio
|
22 |
dominio_objetivo = urlparse(url_objetivo).netloc
|
23 |
|
24 |
+
table_html = "<details><summary>Ver Resultados</summary><table border='1'><tr><th>Posici贸n</th><th>T铆tulo</th><th>URL</th></tr>"
|
25 |
|
26 |
estilo = "color: #ed4b4b;"
|
27 |
|
|
|
53 |
|
54 |
table_html += f"<tr><td>{i+1}</td><td>{header}</td><td><span style='{estilo_dominio}'>{link_clean}</span></td></tr>"
|
55 |
|
56 |
+
table_html += "</table></details>"
|
57 |
|
58 |
+
mensaje = ""
|
59 |
if len(posiciones_dominio) > 1 and 1 in posiciones_dominio:
|
60 |
mensaje = f"Parasitaci贸n SEO: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃"
|
|
|
61 |
elif len(posiciones_dominio) > 1:
|
62 |
mensaje = f"Canibalizaci贸n: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃槙"
|
|
|
63 |
elif len(posiciones_dominio) == 1 and len(posiciones_dominio_exacto) == 0:
|
64 |
mensaje = f"Canibalizaci贸n: URL diferente del dominio en la posici贸n {posiciones_dominio[0]} 馃槙"
|
65 |
elif len(posiciones_dominio) == 1:
|
66 |
mensaje = f"Sin canibalizaci贸n: {url_objetivo} se encuentra en la posici贸n {posiciones_dominio[0]} 馃槙"
|
|
|
67 |
else:
|
68 |
mensaje = f"{url_objetivo} no se encuentra en el top 100 馃槙"
|
|
|
69 |
|
70 |
return mensaje, table_html
|
71 |
|
72 |
def canibalizacion_interface(url, keyword):
|
73 |
mensaje, tabla = buscar_google(keyword, url)
|
74 |
+
return f"Posici贸n:\n<br>{mensaje}", tabla
|
75 |
|
76 |
iface = gr.Interface(
|
77 |
fn=canibalizacion_interface,
|