|
11 | 11 | EXCLUDE_INHERITED = True
|
12 | 12 | EXCLUDE_INHERITED_STATIC = True
|
13 | 13 |
|
14 |
| -URL_RUNTIME_CLASSES = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.html' |
15 |
| -URL_RUNTIME_ATTRIBUTES = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Attributes.html' |
16 |
| -URL_RUNTIME_ENUMERATIONS = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Enumerations.html' |
17 |
| -URL_EDITOR_CLASSES = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Editor_Classes.html' |
18 |
| -URL_EDITOR_ATTRIBUTES = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Editor_Attributes.html' |
19 |
| -URL_EDITOR_ENUMERATIONS = 'http://docs.unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Editor_Enumerations.html' |
| 14 | +CLASS_RUNTIME_CLASSES = 'classRuntime' |
| 15 | +CLASS_RUNTIME_ATTRIBUTES = 'attrRuntime' |
| 16 | +CLASS_RUNTIME_ENUMERATIONS = 'enumRuntime' |
| 17 | +CLASS_EDITOR_CLASSES = 'classEditor' |
| 18 | +CLASS_EDITOR_ATTRIBUTES = 'attrEditor' |
| 19 | +CLASS_EDITOR_ENUMERATIONS = 'enumEditor' |
20 | 20 |
|
21 | 21 | BASE_URL = 'http://docs.unity3d.com/Documentation/ScriptReference/'
|
22 | 22 |
|
|
67 | 67 | def getPage(url):
|
68 | 68 | return webGetter.getUrl(url)
|
69 | 69 |
|
70 |
| -def readTopList(url): |
71 |
| - page = html.fromstring(getPage(url)) |
| 70 | +def readTopList(domClass): |
| 71 | + page = html.fromstring(getPage(BASE_URL)) |
72 | 72 | classes = {}
|
73 |
| - for link in page.xpath('//a[@class="classlink"]'): |
| 73 | + for link in page.xpath('//li[@class="' + domClass + '"]/a'): |
74 | 74 | className = link.text.strip()
|
75 | 75 | classUrl = link.get('href')
|
76 | 76 | classes[className] = readClass(BASE_URL + classUrl, className)
|
@@ -150,11 +150,11 @@ def parseParam(param):
|
150 | 150 |
|
151 | 151 |
|
152 | 152 | data = {}
|
153 |
| -data['Runtime Classes'] = readTopList(URL_RUNTIME_CLASSES) |
154 |
| -data['Runtime Attributes'] = readTopList(URL_RUNTIME_ATTRIBUTES) |
155 |
| -data['Runtime Enumerations'] = readTopList(URL_RUNTIME_ENUMERATIONS) |
156 |
| -data['Editor Classes'] = readTopList(URL_EDITOR_CLASSES) |
157 |
| -data['Editor Attributes'] = readTopList(URL_EDITOR_ATTRIBUTES) |
158 |
| -data['Editor Enumerations'] = readTopList(URL_EDITOR_ENUMERATIONS) |
| 153 | +data['Runtime Classes'] = readTopList(CLASS_RUNTIME_CLASSES) |
| 154 | +data['Runtime Attributes'] = readTopList(CLASS_RUNTIME_ATTRIBUTES) |
| 155 | +data['Runtime Enumerations'] = readTopList(CLASS_RUNTIME_ENUMERATIONS) |
| 156 | +data['Editor Classes'] = readTopList(CLASS_EDITOR_CLASSES) |
| 157 | +data['Editor Attributes'] = readTopList(CLASS_EDITOR_ATTRIBUTES) |
| 158 | +data['Editor Enumerations'] = readTopList(CLASS_EDITOR_ENUMERATIONS) |
159 | 159 |
|
160 | 160 | pickle.dump(data, open(OUTPUT_FILENAME, 'wb'), pickle.HIGHEST_PROTOCOL)
|
0 commit comments