优化cdn。

pull/100/head
wenxianping 2019-01-07 11:54:47 +08:00
parent 2cb98db402
commit 2df57447d3
2 changed files with 13 additions and 31 deletions

View File

@ -53,14 +53,23 @@ class CDNProxy:
def open_cdn_file(self):
cdn = []
cdn_re = re.compile("CONNECT (\S+) HTTP/1.1")
# cdn_re = re.compile("CONNECT (\S+) HTTP/1.1")
# path = os.path.join(os.path.dirname(__file__), '../cdn_list')
# with open(path, "r") as f:
# for i in f.readlines():
# # print(i.replace("\n", ""))
# cdn_list = re.findall(cdn_re, i)
# if cdn_list and "kyfw.12306.cn:443" not in cdn_list:
# print(cdn_list[0].split(":")[0])
# cdn.append(cdn_list[0].split(":")[0])
# return cdn
path = os.path.join(os.path.dirname(__file__), '../cdn_list')
with open(path, "r") as f:
for i in f.readlines():
# print(i.replace("\n", ""))
cdn_list = re.findall(cdn_re, i)
if cdn_list and "kyfw.12306.cn:443" not in cdn_list:
cdn.append(cdn_list[0].split(":")[0])
if i and "kyfw.12306.cn:443" not in i:
cdn.append(i.replace("\n", ""))
print(cdn)
return cdn
def get_cdn_list(self):

View File

@ -53,33 +53,6 @@ def codexy(Ofset=None, is_raw_input=True):
post = []
offsetsX = 0 # 选择的答案的left值,通过浏览器点击8个小图的中点得到的,这样基本没问题
offsetsY = 0 # 选择的答案的top值
# for ofset in select:
# if ofset == '1':
# offsetsY = 46
# offsetsX = 42
# elif ofset == '2':
# offsetsY = 46
# offsetsX = 105
# elif ofset == '3':
# offsetsY = 45
# offsetsX = 184
# elif ofset == '4':
# offsetsY = 48
# offsetsX = 256
# elif ofset == '5':
# offsetsY = 36
# offsetsX = 117
# elif ofset == '6':
# offsetsY = 112
# offsetsX = 115
# elif ofset == '7':
# offsetsY = 114
# offsetsX = 181
# elif ofset == '8':
# offsetsY = 111
# offsetsX = 252
# else:
# pass
for ofset in select:
if ofset == '1':
offsetsY = 77