/**This code is to spider http://www.ifeng.com's top news.
 * @author Zixuan
 * Date 2015-3-28
 */
import java.io.*;
import java.net.*;
import java.util.regex.*;
public class NetSpider
{

	public static void main(String[] args) 
	{	
		StringBuffer pageBuffer = new StringBuffer();	
		String line;
		try 
		{
		 	URL url = new URL("http://www.ifeng.com");
			// Open connection to URL for reading.
			 BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
			// Read page into buffer.		    
			 pageBuffer = new StringBuffer();
			while ((line = reader.readLine()) != null)
				pageBuffer.append(line);
		    	//System.out.println(pageBuffer.toString());
		} 
		catch (Exception e) 
		{
		    	e.printStackTrace();
		}

		//Split first time.
		String pattern = "</a></div></div>";	
		String[] arr = Pattern.compile(pattern).split(pageBuffer.toString());
		line = arr[1];
		
		//Split again.
		pattern = "</ul></div>";
		arr = Pattern.compile(pattern).split(line);
		line = arr[0];
		
		pattern = "href=\"";
		String[] info = Pattern.compile(pattern).split(line);
		pattern = "\" target=\"_blank\">";
		
		//for (int i = 1; i < info.length; i++)
		//	System.out.println(info[i]);
		
		for (int i = 1; i < info.length; i++)
		{
			String temp[] = Pattern.compile(pattern).split(info[i]);
			info[i] = "";
			for (int j = 0; j < temp.length; j++)
			{
				if (1 == j)
					temp[1] = Pattern.compile("</a>").split(temp[1])[0];
				info[i] += temp[j];
				info[i] += "\t\t";
			}
		}
		
		for (int i = 1; i < info.length; i++)
			System.out.println(info[i]);
			
	}

}

@@ -92,12 +92,14 @@
 -28%0A
+ *
  */%0A
-
 impo
@@ -305,17 +305,16 @@
  %0A%09%09%7B%0A%09%09
- 
 %09URL url
@@ -351,17 +351,20 @@
 om%22);%0A%09%09
-%09
+    
 // Open 
@@ -396,17 +396,19 @@
 ding.%0A%09%09
-%09
+   
  Buffere
@@ -496,17 +496,20 @@
 8%22));%0A%09%09
-%09
+    
 // Read 
@@ -534,17 +534,19 @@
 %09    %0A%09%09
-%09
+   
  pageBuf
@@ -573,17 +573,20 @@
 er();%0A%09%09
-%09
+    
 while ((
@@ -622,17 +622,20 @@
 null)%0A%09%09
-%09
+    
 %09pageBuf
@@ -658,17 +658,16 @@
 ;%0A%09%09    
-%09
 //System
@@ -737,20 +737,16 @@
  %0A%09%09%7B%0A%09%09
-    
 %09e.print
@@ -1140,17 +1140,16 @@
 _blank%5C%22
-%3E
 %22;%0A%09%09%0A%09%09
@@ -1490,16 +1490,16 @@
 emp%5Bj%5D;%0A
+
 %09%09%09%09info
@@ -1508,18 +1508,16 @@
 %5D += %22%5Ct
-%5Ct
 %22;%0A%09%09%09%7D%0A

Update NetSpider.java