ºìÁªLinuxÃÅ»§
Linux°ïÖú

JavaʵÏÖÀûÓÃËÑË÷ÒýÇæÊÕ¼¯ÍøÖ·µÄ³ÌÐò

·¢²¼Ê±¼ä:2006-06-27 11:44:49À´Ô´:ºìÁª×÷Õß:·ÉÃÎ
¡¡ÎÒÕâÀï½²µÄ²»ÊÇÔõôʹÓÃËÑË÷ÒýÇ棬¶øÊÇÔõôÈóÌÐòÀûÓÃËÑË÷ÒýÇæÀ´ËѼ¯ÍøÖ·£¬ÕâÓÐʲôÓ㿺ÜÓÐÓã¡ÍøÉ϶¯éüÓÐÈ˽ÐÂôÍøÖ·Êý¾Ý¿â£¬Èç·¢²¼Èí¼þÍøÖ·¡¢ÓʼþµØÖ·¡¢ÂÛ̳ÍøÖ·¡¢ÐÐÒµÍøÖ·£¬ÕâЩÍøÖ·ÊÇÔõôÀ´µÄÄØ£¿²»¿ÉÄÜÊÇÈËÊÖ¹¤ÊÕ¼¯¶øÀ´µÄ£¬¶¼ÊÇÈóÌÐòÀûÓÃËÑË÷ÒýÇæÈ¡µ½µÄ£¬Èç¹ûÄúÐèҪijÀàÍøÖ·ÐÅÏ¢Êý¾Ý£¬¾Í¸úÎÒÀ´Ò»ÆðÑо¿Ò»Ï£¬·Ç³£¼òµ¥¡£

¡¡¡¡±¾ÎIJÉÓÃJavaÓïÑÔд³É£¬ÒÔgoogleºÍ°Ù¶ÈËÑË÷ÒýÇæΪ¶ÔÏó¡£

¡¡¡¡ÎÒÃÇÒªÀûÓÃgoogle¡¢°Ù¶ÈËÑË÷ÒýÇæµÄËÑË÷¹æÔòÖеÄÁ½Ìõ£¬¹Ø¼ü×ÖËÑË÷ºÍinurlËÑË÷¡£Ê²Ã´ÊÇinurlËÑË÷£¬¾ÍÊÇÄãËùÒªËÑË÷µÄÍøÖ·Öб¾Éí´øÓеĹؼü×Ö£¬±ÈÈçhttp://www.xxx.com/post.asp ,Õâ¸öÍøÖ·¾Íº¬ÓÐpost.aspÕâÑùµÄ¹Ø¼ü×Ö£¬ÔÚËÑË÷ÒýÇæÖÐÌîд¹æÔòÊÇ inurl:post.asp,ÕâÊÇÊÕ¼¯ÍøÖ·µÄ¹Ø¼ü£¬ÒòΪºÜ¶àÍøÖ·±¾Éí»á´øÓÐÌض¨µÄÐÅÏ¢£¬±ÈÈçÈí¼þ·¢²¼µÄÍøÒ³ÍøÖ·ÐÅÏ¢ÖжຬÓÐ publish¡¢submit¡¢tuijianÕâÑùµÄÐÅÏ¢£¬Èçhttp://www.xxx.com/publish.asp,ÕâÑùµÄÍøÖ·¶àÊÇ·¢²¼ÐÅÏ¢µÄÍøÒ³£¬ÔÚ½áºÏÍøÒ³Öб¾Éí¿ÉÄܺ¬ÓеĹؼü×Ö£¬¾Í¿ÉÒÔÓÃËÑË÷ÒýÇæËÑË÷³ö½á¹û£¬È»ºóÎÒÃÇÀûÓóÌÐò½«½á¹ûÈ¡»Ø£¬¶ÔHTMLÒ³Ãæ½øÐзÖÎö£¬È¥³ýûÓÐÓõÄÐÅÏ¢£¬½«ÓÐÓõÄÍøÖ·ÐÅϢдÈëÎļþ»òÕßÊý¾Ý¿â£¬¾Í¿ÉÒÔ¸øÆäËüÓ¦ÓóÌÐò»òÕßÈËÀ´Ê¹ÓÃÁË¡£

¡¡¡¡µÚÒ»²½£¬ÓóÌÐò½«ËÑË÷½á¹ûÈ¡»Ø£¬ÏÈÒÔ°Ù¶ÈΪÀý£¬±ÈÈçÎÒÃÇÒªËÑË÷Èí¼þ·¢²¼µÄÍøÒ³£¬¹Ø¼ü×Ö²ÉÓà ¡°Èí¼þ·¢²¼ °æ±¾ inurl:publish.asp",ÏȵǼ°Ù¶È¿´¿´£¬½«¹Ø¼ü×ÖдÈ룬ȻºóÌá½»£¬ÔÚµØÖ·À¸¾Í»á¿´µ½ http://www.baidu.com/s?ie=gb2312&bs=%C8%ED%BC%FE%B7%A2%B2%BC+%C8%ED%BC%FE%B0%E6%B1%BE+inurl%3Apublish.asp&sr=&z=&cl=3&f=8&wd=%C8%ED%BC%FE%B7%A2%B2%BC+%B0%E6%B1%BE+inurl%3Apublish.asp&ct=0 ,ÖÐÎĹؼü×ÖÈ«¶¼±ä³É±àÂëÁË£¬Ã»ÓйØϵ£¬ÎÒÃÇÔÚ³ÌÐòÖÐÖ±½ÓÓÃÖÐÎÄÒ²ÊÇ¿ÉÒԵģ¬ÆäÖжà¸ö¹Ø¼ü×ÖÓ㫺ÅÏàÁ¬£¬È¥µôһЩûÓÐÓõÄÐÅÏ¢£¬ÎÒÃÇ¿ÉÒ԰ѵØÖ·ÓÅ»¯³É http://www.baidu.com/s?lm=0&si=&rn=20&ie=gb2312&ct=0& wd=Èí¼þ·¢²¼+°æ±¾+inurl%3Apublish%2Easp&pn=0&cl=0£¬ÆäÖÐrn±íʾһҳÏÔʾ¶àÉÙ¸ö½á¹û£¬wd=±íʾÄãÒªËÑË÷µÄ¹Ø¼ü×Ö£¬pn±íʾ´ÓµÚ¼¸Ìõ¿ªÊ¼ÏÔʾ£¬Õâ¸öpn½«ÊÇÎÒÃdzÌÐòÑ­»·È¡½á¹ûµÄ±äÁ¿£¬Ã¿20ÌõÑ­»·Ò»´Î¡£ÎÒÃÇÓÃJavaдµÄ³ÌÐòÀ´Ä£ÄâÕâ¸öËÑË÷µÄ¹ý³Ì£¬Óõ½µÄ¹Ø¼üÀàΪ java.net.HttpURLConnection,java.net.URL£¬ÏÈдһ¸öÌá½»ËÑË÷µÄclass,¹Ø¼ü´úÂëÈçÏ£º

class Search
{
¡¡public URL url;
¡¡public HttpURLConnection http;
¡¡public java.io.InputStream urlstream;
¡¡......
¡¡for(int i=0;i++;i <100)
¡¡{
¡¡¡¡......
¡¡¡¡try {
¡¡¡¡¡¡url = new URL("www.baidu.com/s?lm=0&si=&rn=20&ie=gb2312&ct=0& wd=Èí¼þ·¢²¼+°æ±¾+inurl%3Apublish%2Easp&pn="+beginrecord+"&cl=0");
¡¡¡¡}catch(Exception ef){};
¡¡¡¡try {
¡¡¡¡¡¡http = (HttpURLConnection) url.openConnection();
¡¡¡¡¡¡http.connect();
¡¡¡¡¡¡urlstream = http.getInputStream();
¡¡¡¡}catch(Exception ef){};
¡¡¡¡java.io.BufferedReader l_reader = new java.io.
¡¡¡¡BufferedReader(new java.io.InputStreamReader(urlstream));
¡¡¡¡try {
¡¡¡¡¡¡while ((currentLine = l_reader.readLine()) != null) {
¡¡¡¡¡¡¡¡totalstring += currentLine;
¡¡¡¡¡¡}
¡¡¡¡} catch (IOException ex3) {}
¡¡¡¡....
¡¡¡¡//±¾´ÎËÑË÷µÄ½á¹ûÒѾ­·Åµ½totalstringÖÐÁË£¬ÊÇһЩHTML´úÂ룬ÐèÒªÏÂÒ»²½½øÐзÖÎöÁË¡£
}

¡¡ÔÙÒÔgoogleΪÀý£¬ÉÔ΢ÓÐЩ²»Í¬£¬google¶Ôä¯ÀÀÆ÷½øÐÐÁËһЩ¼ì²â£¬±àÂëÒ²²»Í¬£¬URLΪhttp: //www.google.com/search?q=Èí¼þ·¢²¼+°æ±¾+inurl:publish.asp&hl=zh-CN&lr= &newwindow=1&start=0&sa=N&ie=UTF-8,ÆäÖбàÂëÒªÓÃie=UTF-8,start±íʾ´ÓµÚ¼¸Ìõ¼Ç¼ÏÔʾ£¬ÐèҪעÒâµÄÊÇgoogle¶Ôä¯ÀÀÆ÷»¹Òª¼ì²é£¬Èç¹ûä¯ÀÀÆ÷²»·ûºÏËüµÄÒªÇ󣬽«·µ»Ø´íÎó´úÂ룬ËùÒÔÔÚÄ£Äâä¯ÀÀÆ÷Ìá½»ÖУ¬ÎÒÃÇÒª¶à¼ÓÒ»ÐдúÂ룬Ð޸Ĺؼü²¿·ÖÒª½«httpÊôÐÔÖеÄUser-AgentÉèÖÃΪ³£ÓõÄä¯ÀÀÆ÷£¬±ÈÈçMozilla/4.0,´úÂëÈçÏ£º

try {
¡¡http = (HttpURLConnection) url.openConnection();
¡¡http.setRequestProperty("User-Agent", "Mozilla/4.0");
¡¡http.connect();
¡¡urlstream = http.getInputStream();
}catch(Exception ef){};

¡¡¡¡µÚ¶þ²½£¬¶ÔÈ¡»ØµÄHTML±àÂë½øÐзÖÎö£¬È¡³öÆäÖеÄÓÐÓÃÍøÖ·ÐÅÏ¢£¬²¢Ð´ÈëÎļþ»òÕßÊý¾Ý¿â£¬ÓÉÓÚÕâЩËÑË÷ÒýÇ涼ÓÐÍøÒ³¿ìÕÕºÍÏàËÆÍøÒ³µÈÍøÖ·ÐÅÏ¢»ìÔÓÔÚHTMLÖУ¬ÎÒÃÇÒª½«ÕâЩÍøÖ·ÐÅÏ¢ÌÞ³ýµô£¬ÌÞ³ýµÄ¹Ø¼ü¾ÍÊÇÕÒ³öÆäÖеĹæÂÉ£¬°Ù¶ÈËÑË÷ÒýÇæÖеÄÍøÒ³¿ìÕÕºÍÆäËüûÓÐÓõĵĵØÖ·¶¼º¬ÓÐbaiduÕâ¸ö¹Ø¼ü×Ö£¬¶øgoogleÖк¬ÓеÄÎÞÓÃÍøÖ·ÐÅÏ¢º¬Óйؼü×Ö googleºÍcache,ÎÒÃǾ͸ù¾ÝÕâЩ¹Ø¼ü×ÖÌÞ³ýÎÞÓÃÍøÖ·ÐÅÏ¢¡£ÔÚJavaÖÐÒª¶Ô×Ö·û´®½øÐзÖÎö±ØȻҪÓõ½ java.util.StringTokenizeÕâ¸öÀ࣬ÓÃÀ´½«×Ö·û´®ÒÔÌض¨µÄ·Ö¸ô·û·Ö¿ª£¬java.util.regex.PatternºÍ java.util.regex.MatcherÓÃÀ´Æ¥Åä×Ö·û´®£¬¹Ø¼ü´úÂëÈçÏ£º

class CompareStr
{
¡¡public boolean comparestring(String oristring,String tostring)
¡¡{
¡¡¡¡Pattern p=null; //ÕýÔò±í´ïʽ
¡¡¡¡Matcher m=null; //²Ù×÷µÄ×Ö·û´®
¡¡¡¡boolean b;
¡¡¡¡p = Pattern.compile(oristring,Pattern.CASE_INSENSITIVE);
¡¡¡¡m = p.matcher(tostring);
¡¡¡¡b = m.find();
¡¡¡¡return b;
¡¡}
}

class AnalyUrl
{
¡¡......
¡¡StringTokenizer token = new StringTokenizer(totalstring," <> \"");
¡¡String firstword;
¡¡CompareStrcompstr = new CompareStr();
¡¡String dsturl = null;
¡¡while (token.hasMoreTokens())
¡¡{
¡¡¡¡firstword = token.nextToken();
¡¡¡¡if (!compstr.comparestring("google.com", firstword) && !compstr.comparestring("cache",firstword))
¡¡¡¡{
¡¡¡¡¡¡if (firstword.length() > 7)
¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡dsturl = firstword.substring(6,firstword.length() - 1);
¡¡¡¡¡¡¡¡WriteUrl(dsturl); //³É¹¦È¡µ½URL£¬¼Ç¼µ½ÎļþÖÐ
¡¡¡¡¡¡}
¡¡¡¡}
¡¡}
}
¡¡¡¡Í¨¹ýÒÔÉϳÌÐò£¬ÎÒÃǾͿÉÒÔÊÕ¼¯µ½×Ô¼ºÒªµÄÍøÖ·ÐÅÏ¢ÁË£¬»¹¿ÉÒÔÔÙдÁíÍâÒ»¸öÓ¦ÓóÌÐò£¬¶ÔÊÕ¼¯µ½µÄÍøÖ·ÐÅÏ¢½øÒ»²½·ÖÎö£¬È¡³ö×Ô¼ºÐèÒªµÄÐÅÏ¢£¬ÕâÀï¾Í²»ÔÙÀÛ׸£¬µÀÀí¶¼ÊÇÒ»ÑùµÄ¡£×îºóÐè˵Ã÷Ò»µã£¬googleËÑË÷ÒýÇæËÑË÷ËùÄÜ·µ»ØµÄ½á¹û²»Äܳ¬¹ý1000Ìõ£¬¹ýÁË1000Ìõ£¬¾ÍÖ±½ÓÌáʾ¡°¶Ô²»Æ𣬠Google ΪËùÓвéѯµÄ½á¹ûÊý¶¼²»»á³¬¹ý 1000 ¸ö¡£¡±£¬°Ù¶ÈËÑË÷ÒýÇæ·µ»ØµÄ½á¹û²»Äܳ¬¹ý700¶àÌõ£¬ËùÒÔÎÒÃÇÒªËÑË÷ʱ¾¡¿ÉÄܶà¼Ó¹Ø¼ü×Ö£¬½«½á¹û·¶Î§ËõС¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 9 ÌõÆÀÂÛ

  1. 59.25.9.* ÓÚ 2007-07-19 06:02:17·¢±í:

    http://www.la-ringtones.com/mp3/ ringtones site free. Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . from website .

  2. 59.25.9.* ÓÚ 2007-07-19 06:02:13·¢±í:

    http://www.la-ringtones.com/mp3/ ringtones site free. qwest ringtones: Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . nextel ringtones from website .

  3. 194.88.214.* ÓÚ 2007-07-19 06:01:55·¢±í:

    http://www.la-ringtones.com/mp3/ ringtones site free. qwest ringtones: Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . nextel ringtones from website .

  4. 194.88.214.* ÓÚ 2007-07-19 06:01:42·¢±í:

    http://www.la-ringtones.com/mp3/ ringtones site free. qwest ringtones: Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . nextel ringtones from website .

  5. 194.88.214.* ÓÚ 2007-07-19 06:01:03·¢±í:

    http://www.la-ringtones.com/mp3/ ringtones site free. qwest ringtones: Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . nextel ringtones from website .

  6. 194.88.214.* ÓÚ 2007-07-19 06:00:49·¢±í:

    http://www.la-ringtones.com/tones/ real ringtones. motorola ringtones: Best free samsung ringtones, Cingular ringtones and more, Ringtones for free . http://www.la-ringtones.com/ring/ [link=http://www.la-ringtones.com]tracfone ringtones[/link] from site .

  7. ÓÚ 2006-09-25 21:45:11·¢±í:

    ÉòÑô»ªºã024-88324639Ìṩ¸÷ÖÖÐ͵綯±¬Ã×»¨»ú,ÊÖÒ¡±¬Ã×»¨»ú¸÷ÖÖ´ó×ì°Í±¬Ã×»¨»ú,Ë«¹ø±¬Ã×»¨»ú,ÓñÃ×±¬»¨»úÍøÕ¾www.cy139.com±¬Ã×»¨»ú,±¬¹È»ú,±¬»¨»ú,·¿×ÓºÀ»ªÐÍ,ƽͷÐÍ,µç¼ÓÈÈÔ´!ÊÖ¶¯µç¶¯µç¼ÓÈÈ,úÆø¼ÓÈÈÑùÑùÆëÈ«!ÔùË͸÷ÖÖÏãÐͲÊÉ«Åä·½¹¤ÒÕ
    5500

  8. ÓÚ 2006-09-25 21:45:11·¢±í:

    ÉòÑô»ªºã024-88324639Ìṩ¸÷ÖÖÐ͵綯±¬Ã×»¨»ú,ÊÖÒ¡±¬Ã×»¨»ú¸÷ÖÖ´ó×ì°Í±¬Ã×»¨»ú,Ë«¹ø±¬Ã×»¨»ú,ÓñÃ×±¬»¨»úÍøÕ¾www.cy139.com±¬Ã×»¨»ú,±¬¹È»ú,±¬»¨»ú,·¿×ÓºÀ»ªÐÍ,ƽͷÐÍ,µç¼ÓÈÈÔ´!ÊÖ¶¯µç¶¯µç¼ÓÈÈ,úÆø¼ÓÈÈÑùÑùÆëÈ«!ÔùË͸÷ÖÖÏãÐͲÊÉ«Åä·½¹¤ÒÕ
    1147

  9. ÓÚ 2006-09-25 21:45:11·¢±í:

    ÉòÑô»ªºã024-88324639Ìṩ¸÷ÖÖÐ͵綯±¬Ã×»¨»ú,ÊÖÒ¡±¬Ã×»¨»ú¸÷ÖÖ´ó×ì°Í±¬Ã×»¨»ú,Ë«¹ø±¬Ã×»¨»ú,ÓñÃ×±¬»¨»úÍøÕ¾www.cy139.com±¬Ã×»¨»ú,±¬¹È»ú,±¬»¨»ú,·¿×ÓºÀ»ªÐÍ,ƽͷÐÍ,µç¼ÓÈÈÔ´!ÊÖ¶¯µç¶¯µç¼ÓÈÈ,úÆø¼ÓÈÈÑùÑùÆëÈ«!ÔùË͸÷ÖÖÏãÐͲÊÉ«Åä·½¹¤ÒÕ
    5973