Cocos2d-x is a good cross-platform game engine, more information can view the Chinese official website, there are a lot of tutorials, but the layout is not very good, it is not convenient to view all, write a script to catch it, generate a simple web page for easy global viewing. The Code is as follows:
# -*- coding: utf-8 -*-import urllib2firsturl="http://cn.cocos2d-x.org/"def main(): file = open("index.html","w") writehead(file) writetable(file) writeend(file) file.close()def writetable(file): file.write(‘<table width="100%" border="2" cellpadding="2" cellspaceing="0">‘) result = urllib2.urlopen(firsturl+"tutorial/index") line = result.readline() while line: if ‘<a href="/tutorial/lists?id=‘ in line and ‘<td>") file.write(line.replace("/tutorial",firsturl+"/tutorial")) cuturl = firsturl+line.split("href")[1].split(‘"‘)[1] result2 = urllib2.urlopen(cuturl) line2 = result2.readline() file.write("</td><td><ul>") while line2: if ‘<a href="/tutorial/show?id‘ in line2 and ‘><‘ in line2: tempurl2 =firsturl+line2.split(‘>‘)[0].split(‘"‘)[-2][1:].replace("amp;","") print tempurl2 result2 = urllib2.urlopen(tempurl2) line2 = result2.readline() file.write("</ul></td></tr>") if ‘<a href="/tutorial/index?level=0&type=cocos2d-x&per_page=‘ in line and ‘>><‘ in line: tempurl = firsturl+line.split(‘>‘)[0].split(‘"‘)[-2][1:].replace("amp;","") result = urllib2.urlopen(tempurl) #print tempurl line =result.readline() file.write("</table>")def writehead(file): file.write(‘‘‘<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
After a simple and crude crawling, I thought it was better to figure out the relationship between classes. So I found a good thing called doxygen, which is very easy to use and generates HTML documents from the source code.