Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to webscrape scholar.google.com in Java?

I want to write a Java func grabTopResults(String f) such that grabTopResults("automata theory") returns me a list of the top 100 cited papers on scholar.google.com for "automata theory".

Does anyone have suggestions for what libraries will make my life easy?

Thanks!

like image 955
anon Avatar asked Mar 17 '26 05:03

anon


1 Answers

As I'm sure Google can afford the bandwidth, I'll ignore the question of whether this is immoral/illegal/prohibited by Google's T&C

First thing you need to do is figure out what HTTP request (or requests) you need to issue in order to obtain the page with the data you need. Once you've figured this out, use HttpClient to issue the same request from Java code. The previous link shows example code that explains how to do this.

Once you've downloaded the content of the relevant page, you'll need to use a HTML parser to extract the data you're interested in. The Jericho parser suggested by peperg is a good choice.

If the Google police come knocking, you've never heard of me, OK?

like image 171
Dónal Avatar answered Mar 18 '26 19:03

Dónal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!