Program to scrape NYC DOE school budgets from:
First Time Use (A.K.A If you have never run the program on the computer you are using)
- DOWNLOAD PYTHON 3.6, MAKE SURE TO SELECT "ADD PYTHON TO PATH" OPTION, AND RESTART YOUR COMPUTER
- OPEN UP TERMINAL (CMD IN WINDOWS)
- IF YOU DO NOT KNOW WHAT THIS IS, SEARCH FOR IT: TOP RIGHT CORNER MAGNIFYING GLASS IN MAC AND WINDOWS KEY FOR WINDOWS
- TYPE IN "pip install bs4" AND HIT ENTER
- IF THIS DOES NOT WORK, TYPE "sudo pip install bs4"
- IF THIS STILL DOES NOT WORK THEN TRY INSTALLING PYTHON AGAIN, SELECT "MODIFY", AND THEN SELECT ADD PYTHON TO PATH AND COMPLETE INSTALLATION.
- TYPE IN "pip install requests" AND HIT ENTER
- IF THIS DOES NOT WORK, TYPE "sudo pip install requests"
- DOWNLOAD THE "budget_webscrape.py" FILE AND MOVE TO DESKTOP
- THE GREEN "CLONE OR DOWNLOAD" BUTTON ABOVE AND TO THE RIGHT -> DOWNLOAD ZIP -> UNZIP FILE -> MOVE TO DESKTOP
- MOVE TO STEP 7
- IN THE TERMINAL, USE CD COMMANDS ("cd .." GOES UP A FOLDER, "cd [FOLDERNAME]" GOES DOWN) TO NAVIGATE TO FOLDER CONTAINING BUDGET_WEBSCRAPE.PY
- ADD SCHOOL ATS CODES INTO A FILE CALLED "schools.txt" SEPARATED BY ONLY NEW LINES, THE FILE MUST BE IN THE SAME FOLDER AS BUDGET_WEBSCRAPE.PY. EXAMPLE PROVIDED.
- ADD KEYWORDS INTO A FILE CALLED "keywords.txt" SEPARATED BY ONLY NEW LINES, THE FILE MUST BE IN THE SAME FOLDER AS BUDGET_WEBSCRAPE.PY. EXAMPLE PROVIDED.
- TYPE "python" AND HIT ENTER
- TYPE "import budget_webscrape" AND HIT ENTER
- TYPE "budget_webscrape.main()" AND HIT ENTER
- ERRNO13 PERMISSION DENIED
- Please place the file onto your desktop. If you put it somewhere else your computers permissions may deny write access, and the program will crash early.
- IT WONT CHANGE THE KEYWORDS OR SCHOOLS
- This is because it has already imported the file, and this will need to be done whenever you want to change the keywords or school codes. You have two options to fix this: technical, and simple.
- Close the terminal window, re-open it and start again from step 9.
- Type "import imp" and hit enter, "imp.reload(budget_webscrape)" and hit enter, and type "budget_webscrape.main()" and hit enter.
- IT ISN'T DOING ANYTHING
- You might have created the schools.txt and keywords.txt incorrectly: make sure they are in plain text format and the right filetype. In Windows, using textpad will generally work. Microsoft Office, for example, will often not work. Try editing the example files I provided, only using textpad.
- IT IS GIVING ME WEIRD BUDGET LINES
- This would require programming changes. You can edit the code if you trust yourself, or become create, or do things manually. e.g. subtotal lines for groups of things, you could include "subtotal" to get those lines too.
- WHERE IS THE BUDGET?
- You might have left the old "Budgets.txt" file in the folder before running the program again! This will add on the results to the bottom of the old file. Instead, try deleting or moving the old "Budgets.txt" file before running the program.
- IT IS ONLY DOING 2017-2014
- Yeah. That happens. Unfortunately, you will have to go into "budget_webscrape.py" and edit the code at the bottom to fix that. Good luck :)
- IT WONT FIND THE KEYWORD PROPERLY
- You need to get the case right! Look at the pages it is searching for to find how they capitalize and dictate items.
- IT WONT WORK AT ALL
- I could have messed something up. Start an issue and let me know what the problem is! Alternatively, you can click "Commits" and download an old version of the program (last known working version @ https://github.com/jamesylgan/budgetScrape/tree/a8e051aaf5ae1666e15d3bf018b1149459d80b2c )