123456789101112131415161718192021222324252627282930313233343536 |
- from bs4 import BeautifulSoup
- from anjuke.utils.get_message import *
- from anjuke.utils.setting import *
- def get_price():
- price_list = []
- zhoubian_name_list = get_zhoubian_area()
- zhoubian_url_list = get_zhoubian_url()
- for i in range(len(zhoubian_name_list)):
- name = zhoubian_name_list[i]
- url = zhoubian_url_list[i]
- response_price = requests.get(url = url, headers = headers).content.decode('utf8')
- soup = BeautifulSoup(response_price, 'html.parser')
- price_ = soup.find(class_ = "table is-headless")
- table_trs = price_.find_all('div',class_ = "table-tr")
- for table_tr in table_trs:
- list = []
- yue_fang_lv = table_tr.find_all('div',class_ = 'td')
- for td in yue_fang_lv:
- a = td.text.strip()
-
-
-
-
-
- print(a)
- if __name__ == '__main__':
- get_price()
|