Spaces:
Running
Running
delete temp file
Browse files- _search_bongda_snippet.py +0 -16
_search_bongda_snippet.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
def _search_bongda(topic, limit=6):
|
| 2 |
-
items = []
|
| 3 |
-
try:
|
| 4 |
-
r = req.get(f"https://bongda.com.vn/tim-kiem.html?q={quote(topic)}", headers={'User-Agent': 'Mozilla/5.0'}, timeout=8)
|
| 5 |
-
r.encoding = 'utf-8'
|
| 6 |
-
soup = BeautifulSoup(r.text, 'lxml')
|
| 7 |
-
for a in soup.select('h3 a[href], .title a[href], article a[href]')[:limit*2]:
|
| 8 |
-
t = _clean(a.get_text(strip=True))
|
| 9 |
-
href = a.get('href', '')
|
| 10 |
-
if t and len(t) > 15:
|
| 11 |
-
if not href.startswith('http'): href = 'https://bongda.com.vn' + href
|
| 12 |
-
if 'bongda.com.vn' in href:
|
| 13 |
-
items.append({'title': t, 'url': href, 'via': 'B贸ng 膼谩'})
|
| 14 |
-
if len(items) >= limit: break
|
| 15 |
-
except: pass
|
| 16 |
-
return items
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|