This Python script searches for publicly available Department of Defense (DoD) spending PDFs for FY 2024 and FY 2025 using Google Search. The script extracts direct PDF links and presents them in a structured, color-coded output for easy readability. It also saves the links to a text file (dod_spending_pdfs.txt
).
- Searches for DoD budget spending PDFs for fiscal years 2024 and 2025.
- Extracts direct PDF links from Google search results.
- Checks web pages for embedded PDFs if direct links are not found.
- Displays results in color for improved readability.
- Saves PDF links to a text file (
dod_spending_pdfs.txt
).
Ensure you have Python installed, then install the required dependencies:
pip install requests googlesearch-python beautifulsoup4 colorama
Run the script with:
python3 dod_spending.py
The script will:
- Search for DoD spending PDFs for FY 2024 and FY 2025.
- Display the found PDF links in a structured and color-coded format.
Run with defaults:
python3 dod_spending.py
Custom output file:
python3 dod_spending.py -o results.txt
Verbose mode
python3 dod_spending.py -v
Custom queries
python3 dod_spending.py -q "Custom Search:DoD spending 2023 filetype:pdf" "Another:vendor costs 2024"
This is how it should look:

Below is a MD example of how it would look:
FY 2024 DoD Budget PDFs
[1] https://defense.gov/FY24_Budget.pdf
[2] https://dod.mil/spending/FY24.pdf
FY 2025 DoD Budget PDFs
[1] https://defense.gov/FY25_Budget.pdf
[2] https://dod.mil/spending/FY25.pdf
Search complete! PDF links saved in 'dod_spending_pdfs.txt'
- To search for additional fiscal years, modify the
queries
dictionary in the script. - To increase the number of search results, adjust
num_results
in thefind_pdf_links()
function.
Michael Mendy (c) 2025.