喵吉欧尼酱

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 1 from  selenium  import webdriver
 2 from bs4 import BeautifulSoup
 3 driver = webdriver.Chrome()
 4 bar_url='http://bbs.xiaomi.cn/d-{page}'
 5 for i in range(1,200):
 6     url=bar_url.format(page=i)
 7     driver.get(url)
 8     soup=BeautifulSoup(driver.page_source,'html.parser')
 9     text=soup.find_all('div',{'class':'title'})
10     e=soup.find_all('span',{'class':'numb view'})
11     for Texe in e:
12 
13         bottom1=Texe.text.strip('\n').strip()
14 
15     for Text in text:
16         bottom=Text.text.strip('\n').strip()
17 
18         print(bottom)

 

posted on 2017-09-01 15:38  喵吉欧尼酱  阅读(223)  评论(0)    收藏  举报