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):
|
||||
self.session = HTMLSession()
|
||||
|
||||
@retry(stop_max_attempt_number=3)
|
||||
def _get_data(self, issue, lottery_type='pls'):
|
||||
"""
|
||||
"""
|
||||
|
|
@ -73,7 +74,6 @@ class DataGetter(object):
|
|||
else:
|
||||
print(f'issue:{draw_issue}已经存在')
|
||||
else:
|
||||
|
||||
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_date = table_list.find("td.td_title01 span.span_right")[0].text
|
||||
|
|
@ -86,26 +86,52 @@ class DataGetter(object):
|
|||
print(f'issue:{draw_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):
|
||||
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):
|
||||
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):
|
||||
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__':
|
||||
# issue = "23108"
|
||||
# url = f"https://kaijiang.500.com/shtml/pls/{issue}.shtml"
|
||||
# get_data(url, lottery_type='pls')
|
||||
getter = DataGetter()
|
||||
for i in range(1, 64):
|
||||
try :
|
||||
issue = f"{23}{i:03d}"
|
||||
getter.sfc(issue=issue)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
continue
|
||||
getter.plw('23124')
|
||||
# for i in range(1, 153):
|
||||
# try :
|
||||
# issue = f"{22}{i:03d}"
|
||||
# getter.sfc(issue=issue)
|
||||
# except Exception as e:
|
||||
# print(e)
|
||||
# continue
|
||||
Loading…
Reference in New Issue