def getStations():
"""
???????????
"""
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
st_dict = {}
stations_url = 'https://kyfw.12306.cn/otn/resources/js/framework/station_name.js?station_version=1.8971'
html = requests.get(stations_url, verify=False)
html.raise_for_status()
stations_list = re.findall(r'[\u4e00-\u9fa5]+\|[A-Z]+', html.text)
for stations in stations_list:
area = str(stations).split('|')
stations_name = area[0]
stations_code = area[1]
st_dict[stations_name] = stations_code
return st_dict
评论列表
文章目录