fix: 修改数据获取模块
This commit is contained in:
parent
564e8b5f06
commit
def88dd8cf
50
get_data.py
50
get_data.py
|
|
@ -35,6 +35,7 @@ class DataGetter(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.session = HTMLSession()
|
self.session = HTMLSession()
|
||||||
|
|
||||||
|
@retry(stop_max_attempt_number=3)
|
||||||
def _get_data(self, issue, lottery_type='pls'):
|
def _get_data(self, issue, lottery_type='pls'):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
|
@ -73,7 +74,6 @@ class DataGetter(object):
|
||||||
else:
|
else:
|
||||||
print(f'issue:{draw_issue}已经存在')
|
print(f'issue:{draw_issue}已经存在')
|
||||||
else:
|
else:
|
||||||
|
|
||||||
table_list = r.html.find("table.kj_tablelist02", first=True)
|
table_list = r.html.find("table.kj_tablelist02", first=True)
|
||||||
draw_issue = table_list.find("td.td_title01 span.span_left strong")[0].text
|
draw_issue = table_list.find("td.td_title01 span.span_left strong")[0].text
|
||||||
draw_date = table_list.find("td.td_title01 span.span_right")[0].text
|
draw_date = table_list.find("td.td_title01 span.span_right")[0].text
|
||||||
|
|
@ -86,26 +86,52 @@ class DataGetter(object):
|
||||||
print(f'issue:{draw_issue}已经存在')
|
print(f'issue:{draw_issue}已经存在')
|
||||||
|
|
||||||
def pls(self, issue):
|
def pls(self, issue):
|
||||||
return self._get_data(issue, lottery_type='pls')
|
'''
|
||||||
|
排列三
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
return self._get_data(issue, lottery_type='pls')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
def plw(self, issue):
|
def plw(self, issue):
|
||||||
return self._get_data(issue, lottery_type='plw')
|
'''
|
||||||
|
排列五
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
return self._get_data(issue, lottery_type='plw')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def sd(self, issue):
|
def sd(self, issue):
|
||||||
return self._get_data(issue, lottery_type='sd')
|
'''
|
||||||
|
3D
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
return self._get_data(issue, lottery_type='sd')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def sfc(self, issue):
|
def sfc(self, issue):
|
||||||
return self._get_data(issue, lottery_type='sfc')
|
'''
|
||||||
|
胜负彩
|
||||||
|
'''
|
||||||
|
try:
|
||||||
|
return self._get_data(issue, lottery_type='sfc')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# issue = "23108"
|
# issue = "23108"
|
||||||
# url = f"https://kaijiang.500.com/shtml/pls/{issue}.shtml"
|
# url = f"https://kaijiang.500.com/shtml/pls/{issue}.shtml"
|
||||||
# get_data(url, lottery_type='pls')
|
# get_data(url, lottery_type='pls')
|
||||||
getter = DataGetter()
|
getter = DataGetter()
|
||||||
for i in range(1, 64):
|
getter.plw('23124')
|
||||||
try :
|
# for i in range(1, 153):
|
||||||
issue = f"{23}{i:03d}"
|
# try :
|
||||||
getter.sfc(issue=issue)
|
# issue = f"{22}{i:03d}"
|
||||||
except Exception as e:
|
# getter.sfc(issue=issue)
|
||||||
print(e)
|
# except Exception as e:
|
||||||
continue
|
# print(e)
|
||||||
|
# continue
|
||||||
Loading…
Reference in New Issue