Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,11 +13,7 @@ import requests
|
|
| 13 |
from bs4 import BeautifulSoup
|
| 14 |
import urllib
|
| 15 |
import random
|
| 16 |
-
|
| 17 |
-
theme = gr.themes.Soft(
|
| 18 |
-
primary_hue="blue",
|
| 19 |
-
secondary_hue="orange")
|
| 20 |
-
|
| 21 |
|
| 22 |
# List of user agents to choose from for requests
|
| 23 |
_useragent_list = [
|
|
@@ -42,6 +38,7 @@ def extract_text_from_webpage(html_content):
|
|
| 42 |
tag.extract()
|
| 43 |
# Get the remaining visible text
|
| 44 |
visible_text = soup.get_text(strip=True)
|
|
|
|
| 45 |
return visible_text
|
| 46 |
|
| 47 |
def search(term, num_results=2, timeout=5, ssl_verify=None):
|
|
|
|
| 13 |
from bs4 import BeautifulSoup
|
| 14 |
import urllib
|
| 15 |
import random
|
| 16 |
+
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# List of user agents to choose from for requests
|
| 19 |
_useragent_list = [
|
|
|
|
| 38 |
tag.extract()
|
| 39 |
# Get the remaining visible text
|
| 40 |
visible_text = soup.get_text(strip=True)
|
| 41 |
+
visible_text = visible_text[:8000]
|
| 42 |
return visible_text
|
| 43 |
|
| 44 |
def search(term, num_results=2, timeout=5, ssl_verify=None):
|