Free Python learning video: http://edu.51cto.com/course/course_id-1386.html
Today, I have an idea to find out whether all short domain names have been registered or not. COM domain names composed of a-z1-9 have been registered or not. So I started to work. After Google, I learned that wan.com provides an API to query. Http://panda.www.net.cn/cgi-bin/check.cgi? Area_domain = google.com, Later, google.com can change the domain name you want to query, and the result will return an XML page, as follows
The above is the return page where the domain name has been registered, and the following is the page where the domain name has not been registered. The codes are 211210 respectively
The domain name query API is available, so we have to figure out how to generate 3,4,5-bit combinations of all letters and numbers. This is a difficulty. It is easy for us to generate all 3-bit combinations, but generate 3,4, It seems that it's a bit difficult for the 5-digit. Google didn't get good information, so I drew pictures, thought, and asked friends for ideas. Finally, it was solved. The idea is to replace letters with numbers,
For example, string = "abcdefghijklmnopqrstuvwxyz1234567890"
At that time, the 4-digit domain name generated will be combined into AAAA aaab AAAC Aaad.... AABA AABB... ABAA ABAB, etc., which will be converted into numbers of 0000 0001 0002 0003.... 0010 0011... 0100 0101, which represent the index of string. When the number is alphabetic length, the last digit + 1 will be converted into alphabetic list. The script is as follows:
The script can be downloaded through the attachment and run directly. The results are as follows
Finally, due to the API of Wannet, the query is too frequent and the time interval is too short, and it will be blocked IP soon. Pay attention.