123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import requests
- from anjuke.utils.get_message import *
- from anjuke.utils.setting import *
- def get_price():
-
- periphery_name_list = get_periphery()[0]
- periphery_url_list = get_periphery()[1]
-
- result = []
- for i in range(len(periphery_name_list)):
- name = periphery_name_list[i]
- url = periphery_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")
-
- list1 = []
- for table_tr in table_trs:
- all_mes = table_tr.find_all('div',class_ = 'td')
- zhongji = []
- for td in all_mes:
- a = td.text.strip()
- print('a',a)
-
- zhongji.append(a)
- UporDown = table_tr.find(
- 'div', class_="up") or table_tr.find('div', class_="down")
- attr = UporDown['class'][0]
- if attr == "up":
- tab = 'UP'
- elif attr == "down":
- tab = 'DOWN'
- else:
- tab = 'CONSTANT'
- zhongji.insert(2,tab)
- list1.append(zhongji)
- list1.append(name)
- result.append(list1)
- return result
-
-
-
|