GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — my-python-code/XAGLKP/getinfo.py at master · sosoho/my-python-code Expand file tree/ Copy pathgetinfo.pyMore file actions 56 lines (47 loc) · 1.54 KB / Copy pathgetinfo.pyFile metadata and controls56 lines (47 loc) · 1.54 KB 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 #!/bin/env python # -*- coding:utf-8 -*- # _author:kaliarch import re import requests from bs4 import BeautifulSoup class Getinformation: def __init__(self): """init url""" self.init_url = 'http://www.xaglkp.com/ClassSearch/IndexPost' def getsoup(self): """:return soup""" response = requests.post(self.init_url) soup = BeautifulSoup(response.text, 'html.parser') return soup def getStartAddress(self,soup): """get start address dict""" staraddress = soup.find_all('option', text=re.compile("\w+客运站")) num_list = [1000] add_list = ["全部"] for num in staraddress: num_list.append(num['value']) add_list.append(num.text) startaddrdict = dict(zip(add_list, num_list)) return startaddrdict def getStartDate(self,soup): """get time""" date = soup.find_all('option', text=re.compile("2018.*?")) date_list = [] for num in date: date_list.append(num.text) return date_list def getStartTime(self,soup): """ get start time :return start time list """ times = soup.find_all('option', text=re.compile("\w.*?后")) time_list = ['05:00后'] for num in times: time_list.append(num.text) return time_list if __name__ == '__main__': test = Getinformation() soup = test.getsoup() add = test.getStartAddress(soup) print(add) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |