Another project I've been working on is downloading fundamental data from Yahoo Finance using either Perl or Python. This is a 2 step process as outlined below:
1) First thing we need to do is create and populate a file called "symlist.csv" with symbols such as BHP.AX, ANZ.AX, etc. This can be done manually or you can use either perl script "asxsymlist.pl" or python script "asxsymlist.py" from attached zip file to populate the file. These scripts download the ASX symbols from the ASX website. If you want to use symbols from other stock exchanges then you will need to find some other way to populate the file.
2) Once the file "symlist.csv" has been populated, you can either use perl script "yhfund.pl" or python script "yhfund.py" to download fundamental data from yahoo finance. The results are stored in a comma seperated file called "yhfund.csv".
After you have got a feel for how things are done, you will need to edit the yhfund script to get the data you want. At the top of the file is a variable called "tags" which instructs the script what data you want to download such as P/E ratio. You may need to look up the tags available for yahoo finance to get what you want. The second thing you need to change is the variable "header" as this is written to the top of the csv file so that you know what data you're looking at when you view file "yhfund.csv".
Attached is zip file "yhfund20150502.zip" which contains the scripts "asxsymlist.pl, asxsymlist.py, yhfund.pl and yhfund.py". pl means perl script and py means python script, so you only need to run 2 scripts
Note: You do need to be connected to the internet