Spaces:
Sleeping
Sleeping
File size: 610 Bytes
bb0b469 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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 |