mysql - How to download a nutrition contents from USDA database -
i doing website in users can add own recipes, want calculate nutrition values added recipes. after searching have found ndb.nal.usda.gov/ provides nutrition details food items, how can download details food items. can me how download database contents in usda.
i've taken @ website , opinion.
the webpage checking nutrient levels uses simple get
request. meaning say, can specify variables in url string , obtain results.
for example:
http://ndb.nal.usda.gov/ndb/nutrients/report/nutrientsfrm?max=1000&offset=0&totcount=0&nutrient1=255&nutrient2=203&nutrient3=291&subset=0&fg=&sort=f&measureby=m`
you can see there variables nutrient1=255
, etc. have loop through different variables values , send necessary queries via curl
example.
note can conveniently add max=n
n
number of results want show on page.
the next step sieve out useful information in html
returned. can consider using tools beautifulsoup
you.
Comments
Post a Comment