Spaces:
Sleeping
Sleeping
| from .common import fetch, clean | |
| from bs4 import BeautifulSoup | |
| def search_fbi(query): | |
| html = fetch("https://vault.fbi.gov/search", {"SearchableText": query}) | |
| soup = BeautifulSoup(html, "html.parser") | |
| results = [] | |
| for a in soup.select("a"): | |
| href = a.get("href", "") | |
| if "/vault/" in href: | |
| results.append({ | |
| "title": clean(a.text), | |
| "agency": "FBI", | |
| "date": None, | |
| "snippet": None, | |
| "url": href if href.startswith("http") else "https://vault.fbi.gov" + href | |
| }) | |
| return results |