import java.net.*;
import java.util.*;

public class URLGet
{
	public static void main(String[] argv)throws Exception
	{
		String categoria = new String("ristoranti");
		String citta = new String("savona");
		URL yahoo = new URL("http://maps.google.it/maps?f=q&hl=it&geocode=&q=" + categoria + "+" + citta + "&ie=UTF8&sa=N&start=0");
		//URL yahoo = new URL("file:/home/xraver/Codici/java/URLGet/index.html");
		URLConnection yo = yahoo.openConnection();
		Scanner sc = new Scanner(yo.getInputStream());
		String input;
		StringTokenizer st;
		String s;
		while(sc.hasNext())
		{
			input = sc.nextLine();
			if(input.contains("laddr"))
			{
				st = new StringTokenizer(input, "\"");
				boolean found=false;
				while(st.hasMoreTokens())
				{
					s = st.nextToken();
					if(found)
					{
						System.out.println(s);
						found=false;
					}
					if(s.contains("laddr"))
						found=true;
				}
			}
		}

		//PrintStream pippow = new PrintStream(new File("pippo.txt"));
		//pippow.println("babbo");
		//Scanner pippor = new Scanner(new File("pippo.txt"));
		//System.out.println(pippor.nextLine());
	}
}
