Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,21 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
6 |
def search_fn(query,count):
|
7 |
if count>40:
|
8 |
count = 40
|
@@ -41,8 +55,8 @@ def details_fn(query):
|
|
41 |
soup = BeautifulSoup(page.content, 'html.parser')
|
42 |
title = soup.title.string
|
43 |
print (title)
|
44 |
-
|
45 |
-
print (
|
46 |
file = open("myfile.txt", "w")
|
47 |
file.close()
|
48 |
|
|
|
2 |
import requests
|
3 |
from bs4 import BeautifulSoup
|
4 |
import re
|
5 |
+
'''
|
6 |
+
from selenium import webdriver
|
7 |
+
from bs4 import BeautifulSoup
|
8 |
+
|
9 |
+
url = 'https://www.wikipedia.org/'
|
10 |
+
driver = webdriver.Chrome()
|
11 |
+
driver.get(url)
|
12 |
+
|
13 |
+
html_page = driver.page_source
|
14 |
+
soup = BeautifulSoup(html_page, 'html.parser')
|
15 |
+
title = soup.title.string
|
16 |
+
|
17 |
+
print(title)
|
18 |
|
19 |
+
driver.quit()'''
|
20 |
def search_fn(query,count):
|
21 |
if count>40:
|
22 |
count = 40
|
|
|
55 |
soup = BeautifulSoup(page.content, 'html.parser')
|
56 |
title = soup.title.string
|
57 |
print (title)
|
58 |
+
description = soup.find('meta', attrs={'name':'description'})
|
59 |
+
print (description)
|
60 |
file = open("myfile.txt", "w")
|
61 |
file.close()
|
62 |
|