File size: 761 Bytes
ae84fe4
 
 
12fdb18
ae84fe4
12fdb18
898b622
12fdb18
9827ed6
12fdb18
 
14ac9ce
12fdb18
dfd654f
14ac9ce
12fdb18
 
 
 
898b622
12fdb18
 
 
 
 
 
80b7575
12fdb18
 
ae84fe4
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

# app.py
import streamlit as st
from googlesearch import search

# Function to perform Google search and return the first link
def google_search(query):
    # Perform the search and get the first result
    search_results = search(query, num_results=1)
    first_link = next(search_results, None)
    return first_link

# Streamlit app UI
st.title("Search Link Finder")

# Input field for search query
query = st.text_input("Enter search query", "")

# Button to trigger search
if st.button("Search"):
    if query:
        first_link = google_search(query)
        if first_link:
            st.success(f"First link: [Click here]({first_link})")
        else:
            st.warning("No results found")
    else:
        st.error("Please enter a query")