Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,33 +37,19 @@ def search_fn(query,count):
|
|
| 37 |
def details_fn(query):
|
| 38 |
|
| 39 |
page = requests.get(f"{query}")
|
| 40 |
-
soup = BeautifulSoup(page.content)
|
| 41 |
#links = soup.findAll("a")
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 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)
|
| 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
|
| 67 |
|
| 68 |
def first():
|
| 69 |
out = '''<h1>Loading'''
|
|
|
|
| 37 |
def details_fn(query):
|
| 38 |
|
| 39 |
page = requests.get(f"{query}")
|
|
|
|
| 40 |
#links = soup.findAll("a")
|
| 41 |
+
soup = BeautifulSoup(page.content, 'html.parser')
|
| 42 |
+
title = soup.title.string
|
| 43 |
+
print (title)
|
| 44 |
+
description = soup.description.string
|
| 45 |
+
print (description)
|
| 46 |
file = open("myfile.txt", "w")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
file.close()
|
| 48 |
|
| 49 |
#with open("myfile.txt", "r") as file1:
|
| 50 |
# html_out = file1.read()
|
| 51 |
#out = format_t(html_out)
|
| 52 |
+
return title
|
| 53 |
|
| 54 |
def first():
|
| 55 |
out = '''<h1>Loading'''
|