@@ -0,0 +1,1108 @@
+package program;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0A%0Aimport code.Code;%0A%0Aimport file.Writer;%0A%0Aimport page.HomePage;%0Aimport page.NewsPage;%0Aimport structure.News;%0A%0Apublic class Program %7B%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%09%09%0A%09%09String rootDir = %22D:/YahooNewsView%22;%0A%09%09%0A%09%09if(args.length %3E 0)%7B%0A%09%09%09rootDir = args%5B0%5D;%0A%09%09%7D%0A%09%09%0A%09%09File root = new File(rootDir);%0A%09%09if(!root.exists())%7B%0A%09%09%09root.mkdirs();%0A%09%09%7D%0A%09%09%0A%09%09HomePage homePage = new HomePage();%0A%09%09List%3CString%3E newsPageList = homePage.getNewsPageList();%0A%09%09%0A%09%09for(String newsPageUrl : newsPageList)%7B%0A%09%09%09int startIndex = newsPageUrl.indexOf('=') + 1;%0A%09%09%09String newsName = newsPageUrl.substring(startIndex);%0A%09%09%09%0A%09%09%09//create directory%0A%09%09%09File dir = new File(rootDir + %22/%22 + newsName);%0A%09%09%09if(!dir.exists())%7B%0A%09%09%09%09dir.mkdir();%0A%09%09%09%7Delse%7B%0A%09%09%09%09continue;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09NewsPage newsPage = new NewsPage();%0A%09%09%09News news = newsPage.getNews(newsPageUrl);%0A%09%09%09%0A%09%09%09Writer.write(Code.encode(news.getTitle().getBytes()), rootDir + %22/%22 + newsName + %22/title.txt%22);%0A%09%09%09Writer.write(Code.encode(news.getText().getBytes()), rootDir + %22/%22 + newsName + %22/text.txt%22);%0A%09%09%09%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create Program.java