Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def buscar_google(query, hl='es', num_results=10):
|
|
26 |
header = header.text if header else "Sin título"
|
27 |
link = result.find('a', href=True)['href']
|
28 |
link_clean = link.split('&')[0].split('=')[1] if 'url?q=' in link else link
|
29 |
-
serp_data.append({"Posición": i + 1, "
|
30 |
|
31 |
return serp_data
|
32 |
|
@@ -52,11 +52,12 @@ def generar_html_con_colores(serp_results, common_urls, color_palette):
|
|
52 |
if i < len(serp_results[keyword]):
|
53 |
entry = serp_results[keyword][i]
|
54 |
url = entry["URL"]
|
|
|
55 |
if url in common_urls:
|
56 |
color = color_palette[0] # Use a specific color for common URLs
|
57 |
-
html_table += f"<td><span style='color:{color}'>{
|
58 |
else:
|
59 |
-
html_table += f"<td>{
|
60 |
else:
|
61 |
html_table += "<td></td>"
|
62 |
html_table += "</tr>"
|
@@ -86,7 +87,7 @@ iface = gr.Interface(
|
|
86 |
inputs="text",
|
87 |
outputs=["html", "html"],
|
88 |
title="Comparador de Keywords en Google",
|
89 |
-
description="Introduce las keywords separadas por comas para encontrar coincidencias en los resultados de búsqueda de Google y calcular el porcentaje de similaridad entre ellos."
|
90 |
)
|
91 |
|
92 |
-
iface.launch()
|
|
|
26 |
header = header.text if header else "Sin título"
|
27 |
link = result.find('a', href=True)['href']
|
28 |
link_clean = link.split('&')[0].split('=')[1] if 'url?q=' in link else link
|
29 |
+
serp_data.append({"Posición": i + 1, "URL": link_clean})
|
30 |
|
31 |
return serp_data
|
32 |
|
|
|
52 |
if i < len(serp_results[keyword]):
|
53 |
entry = serp_results[keyword][i]
|
54 |
url = entry["URL"]
|
55 |
+
display_url = "<a href='{url}' target='_blank'>{url}</a>".format(url=url)
|
56 |
if url in common_urls:
|
57 |
color = color_palette[0] # Use a specific color for common URLs
|
58 |
+
html_table += f"<td><span style='color:{color}'>{display_url}</span></td>"
|
59 |
else:
|
60 |
+
html_table += f"<td>{display_url}</td>"
|
61 |
else:
|
62 |
html_table += "<td></td>"
|
63 |
html_table += "</tr>"
|
|
|
87 |
inputs="text",
|
88 |
outputs=["html", "html"],
|
89 |
title="Comparador de Keywords en Google",
|
90 |
+
description="Introduce las keywords separadas por comas para encontrar coincidencias en los resultados de búsqueda de Google y calcular el porcentaje de similaridad entre ellos. Las URLs comunes se resaltarán en color."
|
91 |
)
|
92 |
|
93 |
+
iface.launch()
|