-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathHUMANKIND3dgame.py
80 lines (73 loc) · 2.27 KB
/
HUMANKIND3dgame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import os.path
import time
from selenium.webdriver.common.by import By
import MyUtils
for i in range(2, 60):
url = f'https://3g.ali213.net/gl/html/673909_{i}.html'
page = MyUtils.edge(url)
page.set_window_size(400, 700)
time.sleep(1)
MyUtils.clickelement([page, By.CLASS_NAME, 'read-all'])
time.sleep(1)
# wenming=MyUtils.MyElement([page,By.XPATH,'/html/body/div[7]/div[9]/p[2]/span/strong']).text
# wenming=wenming.strip('文明介绍')
wenming = MyUtils.title([page])
wenming = wenming[wenming.find('-') + 1:wenming.find(' ')]
txt = []
for i in MyUtils.Elements([page, By.TAG_NAME, 'p']):
txt.append(i.text)
if os.path.exists(MyUtils.DesktopPath('huamndkind/' + wenming + '.txt')):
continue
content = MyUtils.txt(MyUtils.DesktopPath('huamndkind/' + wenming + '.txt'))
t = MyUtils.txt(MyUtils.DesktopPath('huamndkind/' + '总计' + '.txt'))
c = False
next = False
b = False
xiayixiang = False
for i in txt:
if i == '':
continue
# 初始化
if i == wenming + '文明介绍':
c = True
if i[:4] == '本质特性':
benzhi = i[-5:-3]
c = False
continue
if i[:4] == '传承特性':
chuancheng = i[5:]
xiayixiang = True
continue
if xiayixiang:
xiayixiang = False
chuancheng += ' : ' + i
continue
if i[:5] == '象征性单位':
danwei = i[6:]
c = True
continue
if i[:2] in ['属性', '花费', '解锁']:
if c:
shuxing = i[3:]
c = False
continue
if i[:4] == '详细信息':
xiangxi = i[5:]
continue
if i[:5] == '象征性区域':
quyu = i[6:]
c = True
continue
if i[:2] == '效果':
xiaoguo = i[3:]
c = False
continue
if c:
if i == '你知道吗?':
content.add('\n')
c = False
content.add(i)
t.add(f'{wenming} {benzhi}主义者 \n {chuancheng} \n {quyu} : {xiaoguo}\n {danwei} : {shuxing} {xiangxi}')
t.save()
content.save()
page.close()