Spaces:
Running
Running
fix: article cache + route overrides
Browse files- app_v2_entry.py +2 -2
app_v2_entry.py
CHANGED
|
@@ -334,9 +334,9 @@ def _scrape_generic(url):
|
|
| 334 |
from urllib.parse import urlparse
|
| 335 |
try:
|
| 336 |
domain=urlparse(url).netloc
|
| 337 |
-
# Use main's rate-limited getter
|
| 338 |
from main import _rl_get
|
| 339 |
-
r=_rl_get(url,headers={'User-Agent':'Mozilla/5.0','Accept-Language':'vi-VN,vi;q=0.9'},timeout=
|
| 340 |
if not r: return None
|
| 341 |
r.encoding='utf-8';soup=BeautifulSoup(r.text,'lxml')
|
| 342 |
for tag in soup.find_all(['script','style','nav','footer','aside','form','noscript']):tag.decompose()
|
|
|
|
| 334 |
from urllib.parse import urlparse
|
| 335 |
try:
|
| 336 |
domain=urlparse(url).netloc
|
| 337 |
+
# Use main's rate-limited getter with shorter timeout for fast response
|
| 338 |
from main import _rl_get
|
| 339 |
+
r=_rl_get(url,headers={'User-Agent':'Mozilla/5.0','Accept-Language':'vi-VN,vi;q=0.9'},timeout=8,domain=domain)
|
| 340 |
if not r: return None
|
| 341 |
r.encoding='utf-8';soup=BeautifulSoup(r.text,'lxml')
|
| 342 |
for tag in soup.find_all(['script','style','nav','footer','aside','form','noscript']):tag.decompose()
|