Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,21 +20,6 @@ import concurrent.futures
|
|
20 |
MAX_WORKERS = 4 # Adjust based on your system resources
|
21 |
executor = concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS)
|
22 |
|
23 |
-
# List of user agents to choose from for requests
|
24 |
-
_useragent_list = [
|
25 |
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0',
|
26 |
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
|
27 |
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
|
28 |
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
|
29 |
-
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
|
30 |
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.62',
|
31 |
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0'
|
32 |
-
]
|
33 |
-
|
34 |
-
def get_useragent():
|
35 |
-
"""Returns a random user agent from the list."""
|
36 |
-
return random.choice(_useragent_list)
|
37 |
-
|
38 |
def extract_text_from_webpage(html_content):
|
39 |
"""Extracts visible text from HTML content using BeautifulSoup."""
|
40 |
soup = BeautifulSoup(html_content, "html.parser")
|
|
|
20 |
MAX_WORKERS = 4 # Adjust based on your system resources
|
21 |
executor = concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def extract_text_from_webpage(html_content):
|
24 |
"""Extracts visible text from HTML content using BeautifulSoup."""
|
25 |
soup = BeautifulSoup(html_content, "html.parser")
|