public static void main (String[] args) throws ParserException
{
try {
TravelWordTable(RadarSpecialSearchEngine.fdz+"/字典.txt");
} catch(Exception e)
{
e.printStackTrace();
}
}
public static void TravelWordTable(String filename) throws IOException
{
try{
String buffer ;
FileWriter resultFile = null;
PrintWriter myFile = null;
String dstfile = filename+ "_dsturl.txt" ;
File writefile = new File(dstfile);
if(!writefile.exists())
{
writefile.createNewFile();
}
resultFile=new FileWriter(writefile);
myFile = new PrintWriter(resultFile);
BufferedReader reader = new BufferedReader(new FileReader(filename));
while((buffer = reader.readLine())!=null)
{
String b = buffer;
System.out.println("开始检索关键字:"+b);
buffer = URLEncoder.encode(buffer, "UTF-8");
String url = "http://s.wanfangdata.com.cn/Paper.aspx?q=" + buffer + "&f=top";
getWanFangUrls(url,"UTF-8",myFile);
System.out.println("关键字:"+b+" 检索完成");
}
if( myFile != null)
myFile.close();
if( resultFile != null)
resultFile.close();
} catch (ParserException e) {
e.printStackTrace();
}
0
685
4.22MB
2017-11-22
41