Find Recipes

Let the Google API transform those random ingredients in your fridge into a wonderful dinner.

Google can help you find news, catalogs, discussions, web pages, and so much more—and it can also help you figure out what to have for dinner tonight!

This hack uses the Google API to help you transform those random ingredients in your fridge into a wonderful dinner. Well, you do have to do some of the work. But it all starts with this hack.

The Code

This hack comes with a built-in form that calls the query and the recipe type, so there’s no need to set up a separate form:

#!/usr/local/bin/perl
# goocook.cgi
# Finding recipes with google.
# goocook.cgi is called as a CGI with form input.
     
# Your Google API developer's key
my $google_key='insert key here'; # Location of the GoogleSearch WSDL file. my $google_wdsl = "./GoogleSearch.wsdl"; use SOAP::Lite; use CGI qw/:standard/; my %recipe_types = ( "General" => "site:allrecipes.com | site:cooking.com | site: epicurious.com | site:recipesource.com", "Vegetarian/Vegan" => "site:fatfree.com | inurl:veganmania | inurl: vegetarianrecipe | inurl:veggiefiles", "Wordwide Cuisine" => "site:Britannia.org | inurl:thegutsygourmet | inurl:simpleinternet | inurl:soupsong" ); print header( ), start_html("GooCook"), h1("GooCook"), start_form(-method=>'GET'), 'Ingredients: ', textfield(-name=>'ingredients'), br( ), 'Recipe Type: ', popup_menu(-name=>'recipe_type', -values=>[keys %recipe_types], -default=>'General'), br( ), submit(-name=>'submit', -value=>"Get ...

Get Google Hacks, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.