如何从谷歌搜索结果页面检索数据并保存该数据#,
我有代码可以从 URL 中检索数据,但我无法从 google 搜索结果中检索数据...
请帮帮我
从 URL 检索数据的代码
enter code here URL iurl = new URL("https://www.google.co.in/search?q=Anirudhcreative%2Cprojects&sub=Submit+Query");
URLConnection urlconn = iurl.openConnection();
System.out.println("url连接>>:"+urlconn);
File f = new File("Ani 7 hindi gogole out put.html"); //************************************ file name ***
FileOutputStream fop = new FileOutputStream(f); BufferedReader br = new BufferedReader(new InputStreamReader(urlconn.getInputStream())); 字符串线;//PrintWriter pw = respons int ii=0; 字符串 st=""; System.out.println(" * ** * ** * ** * ** * 网页输出 * ** * ** * ** * * "); while((line=br.readLine())!= null) {
System.out.println(""+line+"");
ii++;
st=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+ii;
System.out.println(">>>>>>>>>"+ii);
if(f.exists()){
fop.write(line.toString().getBytes());
//fop.write(st.toString().getBytes());