Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,36 @@ def search_fn(query,count):
|
|
34 |
html_out = file1.read()
|
35 |
out = format_t(html_out)
|
36 |
return out
|
|
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
def first():
|
40 |
out = '''<h1>Loading'''
|
@@ -101,14 +130,14 @@ def format_t(inp):
|
|
101 |
return out
|
102 |
with gr.Blocks() as app:
|
103 |
gr.HTML("""<h1>Interactive Social Media Card Maker</h1>""")
|
104 |
-
gr.HTML("""<h3><b>Step 1:</b> Enter URL
|
105 |
with gr.Row():
|
106 |
search_box=gr.Textbox(label = "Enter a search topic here to find URL's",scale=2)
|
107 |
num_return=gr.Number(label= "Number of URL's to return", value=20, scale=1)
|
108 |
search_btn=gr.Button(value= "Search", scale=1)
|
109 |
with gr.Row():
|
110 |
input = gr.Textbox(label = "URL")
|
111 |
-
btn = gr.Button()
|
112 |
output = gr.HTML("""""")
|
113 |
|
114 |
search_btn.click(search_fn,[search_box,num_return],output)
|
|
|
34 |
html_out = file1.read()
|
35 |
out = format_t(html_out)
|
36 |
return out
|
37 |
+
def details_fn(query):
|
38 |
|
39 |
+
page = requests.get(f"{query}")
|
40 |
+
soup = BeautifulSoup(page.content)
|
41 |
+
#links = soup.findAll("a")
|
42 |
+
|
43 |
+
links = soup.findAll(".//title")
|
44 |
+
file = open("myfile.txt", "w")
|
45 |
+
|
46 |
+
#for link in soup.find_all(".//title"):
|
47 |
+
#out = (re.split(":(?=http)",link["href"].replace("/url?q=","").split("&sa",1)[0]))
|
48 |
+
#out = out[0]
|
49 |
+
#rr=requests.get(f"{out}")
|
50 |
+
#x_opt = (dict(rr.headers).get("x-frame-options"))
|
51 |
+
# if x_opt == None:
|
52 |
+
# frame_l=f'<div class="container-mee"><div class="put-on-top"><a target="_blank" href="{out}">{out}</a></div><iframe class="responsive-iframe-mee" src="{out}" frameborder="3"></iframe></div>'
|
53 |
+
# file.writelines(frame_l)
|
54 |
+
# else:
|
55 |
+
# pass
|
56 |
+
|
57 |
+
#print(file1.read())
|
58 |
+
print (links.text)
|
59 |
+
#print(dict(rr.headers).get("x-frame-options"))
|
60 |
+
|
61 |
+
file.close()
|
62 |
+
|
63 |
+
#with open("myfile.txt", "r") as file1:
|
64 |
+
# html_out = file1.read()
|
65 |
+
#out = format_t(html_out)
|
66 |
+
return links.text
|
67 |
|
68 |
def first():
|
69 |
out = '''<h1>Loading'''
|
|
|
130 |
return out
|
131 |
with gr.Blocks() as app:
|
132 |
gr.HTML("""<h1>Interactive Social Media Card Maker</h1>""")
|
133 |
+
gr.HTML("""<h3><b>Step 1:</b> Enter a URL with Iframe capability</h3>""")
|
134 |
with gr.Row():
|
135 |
search_box=gr.Textbox(label = "Enter a search topic here to find URL's",scale=2)
|
136 |
num_return=gr.Number(label= "Number of URL's to return", value=20, scale=1)
|
137 |
search_btn=gr.Button(value= "Search", scale=1)
|
138 |
with gr.Row():
|
139 |
input = gr.Textbox(label = "URL")
|
140 |
+
btn = gr.Button("Preview")
|
141 |
output = gr.HTML("""""")
|
142 |
|
143 |
search_btn.click(search_fn,[search_box,num_return],output)
|