智能机器人java源代码 jnd机器人源码
智能机器人java源代码jnd机器人源码转载GhostLover2023-06-0821:23:10
文章标签智能机器人java源代码java网络stringexception文章分类Java后端开发
Java虚拟网络机器人源代码
packageauto;importjava.net.*;importjava.sql.*;importjava.io.*;importjava.util.*;//importdb.*;publicclasstestextendsThread{URLweburl;Stringurladdr;publictest(){}publictest(Stringurladdr,URLweburl){this.urladdr=urladdr;this.weburl=weburl;}publictest(Stringurladdr){try{this.urladdr=urladdr;//weburl=newURL(urladdr);this.start();}catch(Exceptione){System.out.println(e.toString());}}publicInputStreamgetStream(Stringurl){try{//urladdr=url;URLtempurl=newURL(url);returntempurl.openStream();}catch(Exceptione){System.out.println("hello");}returnnull;}publicvoidrun(){while(true){try{getStream(urladdr);Thread.sleep(200);}catch(Exceptione){}}}publicStringgetStr(InputStreamin){try{StringBuffertemp=null;BufferedReaderbuffer=newBufferedReader(newInputStreamReader(in));Stringtempstr="";Stringstrsum="";while((tempstr=buffer.readLine())!=null){strsum=strsum+tempstr;}buffer.close();//in.close();returnstrsum;}catch(Exceptione){System.out.println("shit");}return"";}publicStringgetMTVURL(Stringhtml){try{Stringtemp=html.substring(html.lastIndexOf("../")+3);temp=temp.substring(0,temp.indexOf("/""));temp="http://movies.v111.com/movies/film/play.asp?Id=30959";+temp;temp=temp.trim();returntemp;}catch(Exceptione){System.out.println(e.toString());}returnnull;}publicStringgetMTVname(Stringhtml){try{Stringtemp=html.substring(html.indexOf("作品名:")+4);temp=temp.substring(0,temp.indexOf(""));temp=temp.trim();returntemp;}catch(Exceptione){System.out.println("hello");}returnnull;}publicvoidinsertdb(StringMTVURL,StringMTVname){//DBoperatewriter=newDBoperate();//Stringinsert="insertintomtvList(mtvname,mtvurl)values(+MTVname+,+MTVURL+)";//writer.exesql(insert);}publicvoidgetover(){InputStreamin=getStream(urladdr);Stringcontent=getStr(in);Stringurl=getMTVURL(content);Stringname=getMTVname(content);insertdb(url,name);}publicstaticvoidmain(String[]avg){for(;;){try{testlook=newtest("";);look.getStream(look.urladdr).close();Thread.sleep(500);}catch(Exceptione){System.out.println(e.toString());continue;}}}}本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。赞收藏评论分享举报上一篇:java一种整数数据压缩的方法java中如何规定整数范围
下一篇:python中charset的设置python的char类型