Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,7 +161,7 @@ def scrape_website(url, headers):
|
|
| 161 |
return {
|
| 162 |
'title': clean_text(title),
|
| 163 |
'meta_description': clean_text(meta_desc),
|
| 164 |
-
'content': text[:
|
| 165 |
'url': url
|
| 166 |
}
|
| 167 |
|
|
@@ -205,8 +205,8 @@ def search_and_scrape(query, num_results=5):
|
|
| 205 |
href = link.get('href', '')
|
| 206 |
|
| 207 |
# Skip if not a valid URL or if it's a Google-related URL
|
| 208 |
-
|
| 209 |
-
|
| 210 |
|
| 211 |
# Add random delay between requests
|
| 212 |
time.sleep(random.uniform(1, 2))
|
|
|
|
| 161 |
return {
|
| 162 |
'title': clean_text(title),
|
| 163 |
'meta_description': clean_text(meta_desc),
|
| 164 |
+
'content': text[:10000], # Limit content length
|
| 165 |
'url': url
|
| 166 |
}
|
| 167 |
|
|
|
|
| 205 |
href = link.get('href', '')
|
| 206 |
|
| 207 |
# Skip if not a valid URL or if it's a Google-related URL
|
| 208 |
+
# if not href.startswith('http') or 'google.' in href:
|
| 209 |
+
# continue
|
| 210 |
|
| 211 |
# Add random delay between requests
|
| 212 |
time.sleep(random.uniform(1, 2))
|