Bored, "Unicom Online business Hall" selection attempt

Source: Internet
Author: User

Beijing Unicom Number recently came out of the No. 185th paragraph, has not run Beijing's number, in the Unicom online business hall election number, so on the germination of the idea of choosing a beautiful, so turned over the structure of the site, long Connection + with the unit to achieve.

Immediately start to write the program to get the mobile phone number, and then filter the phone number (regular match, reverse reference, 0 wide assertion).


Seed Address:

http://num.10010.com/numapp/goodsdetail/querymorenums?callback=jsonp_querymorenums&province=11& Citycode=110&rankmoney=76&q_p=${page}&net=01&prefeesel=0&show4gnum=true&_=${random}


HTTP requests made with HttpClient, the return value is in JSON format (with the Jsel expression, personally feel very sharp), the mobile phone number exists in the Morenumarray attribute, the array type.

Get the data, filter the data, filter out the AAAA,AAA,AABB,ABCD,ABC,DCBA,CBA type of mobile phone number, and then save to a local file, it is so simple, the program is implemented as follows:


Public class phonenumber {    private static set<string>  NO4 = new TreeSet<String> (    private static set); <String> AAAA = new TreeSet<String> ();    private  Static set<string> aaa = new treeset<string> ();     Private static set<string> aabb = new treeset<string> ();     private static Set<String> ABCD = new TreeSet<String> ();     private static Set<String> DCBA = new TreeSet< String> ();    private static set<string> abc = new  Treeset<string> ();     private static set<string> cba =  new TreeSet<String> ();     private static atomiclong phonenumbersize = new  atomiclong (0);     public static void main (String[] args)   Throws ioexception, urisyntaxexception {        string  seed =  "Http://num.10010.com/NumApp/GoodsDetail/queryMoreNums?callback=jsonp_queryMoreNums &province=11&citycode=110&rankmoney=76&q_p=${page}&net=01&prefeesel=0&show4gnum= True&_=${random} ";         basiccookiestore cookiestore =  new basiccookiestore ();        closeablehttpclient  Httpclient = httpclients.custom (). Setdefaultcookiestore (Cookiestore). Build ();         try {             for  (int i = 0; i < 100; i++)  {                 httpget httpget = new httpget (Seed.replace ("${ Page} ",  new integer (1). toString ()). Replace (" ${random} ",  string.valueof (New date (). GetTime ( )));                 request ( Httpclient, httpget);            }             print ();             report ();         } finally  {            httpclient.close ();         }    }    private static  void report ()   Throws ioexception {        writer ("AAAA", AAAA);         writer ("AAA", AAA);         Writer ("AABB", AABB),         writer ("ABCD", ABCD);         writer ("ABC", ABC);         writer ("DCBA", DCBA);         writer ("CBA", CBA);    }     private static void writer (String name, set set)  throws  Ioexception {        file file = new file ("./ ${name}-${data}.phone ". Replace (" ${name} ",  name). Replace (" ${data} ",  new simpledateformat (" Yyyy-mm-dd-hh-mm-ss "). Format (New date ()));         File.createnewfile ();          printwriter writer = new printwriter (file);         writer.println ("Report:");         Writer.println ("=================================");         Writer.println ("size : ". Concat (String.valueof (Set.size ()));         for  (Iterator iterator = set.iterator ();  iterator.hasnext (); )   {            writer.println (Iterator.next ());         }        writer.close ( );     }    private static closeablehttpresponse request (Closeablehttpclient httpclient, httpget httpget)  throws IOException {         Closeablehttpresponse response = httpclient.execute (HttpGet);         try {            httpentity  entity = response.getentity ();             //            string text =  gettext (Entity.getcontent (),  charset.defaultcharset ());             string json = text.replaceall ("jsonp_querymorenums\\ (. *) \ \);",   "$");             map<string, object > decode = jsondecoder.decode (JSON);             List moreNumArray =  (List)  decode.get ("Morenumarray");        &Nbsp;    int size = morenumarray.size ()  / 7;             phonenumbersize.addandget (size);             for  (int i = 0; i < size ;  i++)  {                 string phoneno = morenumarray.get (i * 7). toString ();                 if  (/*aaaa*/phoneno.matches ("\\d* (\\d) \\1{3,}\\d* ")  {                     aaaa.add (Phoneno);                 } else if  (/*aaa*/phoneno.matches ("\\d* (\\d) \\1{2,}\\ d* ")) &NBSP;{&NBSP;&Nbsp;                   aaa.add (Phoneno);                 } else if  (/*aabb*/phoneno.matches ("\\d* (\\d) \\1 (\\d) \\2\\d*")  {                      Aabb.add (Phoneno);                 } else if  (/*abcd*/phoneno.matches \\d* (?:(?: 0 (? =1) | (? =2) (? =3) |3 (? =4) |4 (? =5) |5 (? =6) |6 (? =7) |7 (? =8) |8 (? =9) {3,}) (\\d* "))  {                     abcd.add (Phoneno);                 } else if  (/*dcba*/phoneno.matches \\d* (?: 9 (? =8) |8 (? =7) |7 (? =6) |6 (? =5) |5 (? =4) |4 (? =3) |3 (? =2) (? =1) | | (? =0)) (3,}\\d*))  {                     dcba.add (PhoneNo);                 } else if  (/*abc* /phoneno.matches ("\\d* (?:(?: 0 (? =1) | (? =2) (? =3) |3 (? =4) |4 (? =5) |5 (? =6) |6 (? =7) |7 (? =8) |8 (? =9) {2,}) (\\d* "))  {                     abc.add (Phoneno);                 } else if  (/*cba*/phoneno.matches \\d* (?: 9 (? =8) |8 (? =7) |7 (? =6) |6 (? =5) |5 (? =4) |4 (? =3) (|3) (?) (? =2) | | (? =1)) (=0))  {                     cba.add (PhoneNo);                 } else if  (!phoneno.matches ("\\d*4\\d*")/*NO4*/)  {                      no4.add (Phoneno);                 }            }         } finally {             response.close ();        }         return response;    }    private  Static void print ()  {        system.out.println ("Report : ");         system.out.println (" ================================= ");     &nbSp;   system.out.println ("size : ". Concat (Phonenumbersize.tostring ()));         system.out.println ("\taaaa : ". Concat (String.valueof (AAAA.size () ));         system.out.println ("\taaa : ". Concat ( String.valueof (Aaa.size ()));         system.out.println ("\TAABB&NBSP;:   ". Concat (String.valueof (Aabb.size ()));         System.out.println ("\tabcd : ". Concat (String.valueof (Abcd.size ()));         system.out.println ("\tabc : ". Concat (String.valueof (Abc.size ()));         system.out.println ("\tdcba : ". Concat (String.valueof (DCBA.size () ));         system.out.println ("\tcba : ". Concat ( String.valueof (Cba.size ())); &NBSP;&NBSP;&NBSP;&NBSP;}&NBSp;   public final static string gettext (InputStream inputStream,  charset charset)  throws IOException {         stringbuilder text = new stringbuilder ();         try {            BufferedReader  Read = new bufferedreader (New inputstreamreader (Inputstream, charset.name ()));             String line = null;             while  (Line = read.readline ( ))  {               != null)    text.append (line);             }      &nbSp;  } finally {            if   (Inputstream != null)  {                 inputstream.close ();             }        }         Return text.tostring ();     }}


Collected 100 times, quickly completed, saved the local file, the file is as follows:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/43/B0/wKioL1PbxTTiYKErAADOSlSScfk484.jpg "title=" screen shot 2014-08-02 a.m. 12.44.05.png "alt=" Wkiol1pbxttiykeraadoslsscfk484.jpg "/>


Open the file for a look, the classification is complete.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/43/AF/wKiom1PbxGiTZfveAADYSBscZ8U033.jpg "title=" C0569942-70ce-4ee7-a7e6-12b0a2f82150.png "alt=" Wkiom1pbxgitzfveaadysbscz8u033.jpg "/>


Happy to Unicom online business office search. The results found that no crawl of the number, that is, was screened out (blood), and then view the implementation of his web page, there are found elements record number information, that is, Numid, also tried to submit orders, submitted when the number ID to do the check, sleepy, also no egg hurts, sleep!

<p style= "Display:none;" id= "Numinfo" numid= "numIdVal18515291341" num= "185 1529 1341" price= "<span>¥0</s Pan> "monfee=" 0 "nummemo=" number required monthly commitment to spend 0 yuan "numprefee=" 0 "numisnicerule=" 0 "Numle Vel= "0" montime= "0" ></p>



650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/43/B0/wKioL1PbxerhsWa-AAC8q66kHj8048.jpg "title=" 8327a950-f890-435a-838e-a0a9a2c32e3f.png "alt=" Wkiol1pbxerhswa-aac8q66khj8048.jpg "/>



This article is from the "Copper for Mirror" blog, be sure to keep this source http://tangoo.blog.51cto.com/9130178/1534024

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.