简体   繁体   中英

How to get google search results with spesific date in Java?

I have a problem to get the results in google search with java programming. I already used code with Gson, but it just give me 4 results and i can't search it with specific date i want. I want to get 10 results like URL, Title and content in the first page in search and with spesific date like from 1 january 2013 until 30 january 2013. In the manual search in google we can use this spesific date when searching, but i don't know how to use it in Java. The code i used:

String google = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=9&q=";
String search = "news";
String charset = "UTF-8";
URL url = new URL(google + URLEncoder.encode(search, charset));
Reader reader = new InputStreamReader(url.openStream(), charset);
GoogleResults results = new Gson().fromJson(reader, GoogleResults.class);

..............................................

Anyone can help me please?

use Jsoup api best for html parsing

Using JSoup to scrape Google Results

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM