Preface: I have compiled some useful java files.Program. This is a simple Web Crawler to get the email address.
Package COM. lianggzone. demo; import Java. io. ioexception; import Java. io. inputstream; import java.net. httpurlconnection; import java.net. URL; import Java. util. regEx. matcher; import Java. util. regEx. pattern;/*** the web crawler obtains the email address * @ author lianggzone */public class emailspider {public static void main (string [] ARGs) {URL url = NULL; string RegEx = "[\ W [. -] + @ [\ W [. -] + \\. [\ W] + "; string tempstr = NULL; pattern = pattern. compile (RegEx); matcher = NULL; try {// get URL url = new URL ("http://zhidao.baidu.com/question/92607106.html"); // connect URL address httpurlconnection urlconnection = (httpurlconnection) URL. openconnection (); urlconnection. connect (); // define the input stream inputstream in = urlconnection. getinputstream (); byte [] Buf = new byte [4096]; while (in. read (BUF)> 0) {tempstr = new string (BUF); matcher = pattern. matcher (tempstr); While (matcher. find () {system. out. println (matcher. group () ;}} catch (ioexception e) {e. printstacktrace ();}}}
Note: here there is a link to the database, not the GUI interface, then, modify the url = new URL ("http://zhidao.baidu.com/question/92607106.html"); change to the address you want.