GodsDevProject's picture
Rename fbi.py to adapters/fbi.py
aa4e9bf verified
raw
history blame contribute delete
610 Bytes
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