package pic;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import tool.*;
public class pro {
String[] data=new String[6000];
int s,datanumber;
String[] name=new String[6000];
String[] code=new String[6000];
String[] code_name=new String[6000];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int tr;
for(tr=12;tr<29;tr++){
String urlx="http://www29.atwiki.jp/cdtv/pages/"+tr+".html";
dl sub7=new dl();
sub7.makedata(urlx,"data/"+tr+".txt");
}
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
package pic;
import java.io.*;
import java.io.File;
import java.net.URL;
import java.net.URLConnection;
import java.io.File;
import java.io.*;
public class dl {
void makedata(String urlx,String filex){
try {
URL url = new URL(urlx);
URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5");
InputStream in = conn.getInputStream();
File file = new File(filex);
FileOutputStream out = new FileOutputStream(file, false);
int b;
while((b = in.read()) != -1){
out.write(b);
}
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
最終更新:2016年09月10日 02:29