亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

html - Python爬蟲,翻頁(yè)數(shù)據(jù)怎么爬,URL不變
大家講道理
大家講道理 2017-04-18 10:31:18
0
4
1023

網(wǎng)址:http://quote.eastmoney.com/ce...
我想爬所有頁(yè)的名稱數(shù)據(jù),(這里只有兩頁(yè)),判斷有沒有下一頁(yè)的條件該怎么寫呢?
代碼:

from selenium import webdriver
driver=webdriver.PhantomJS()

url='http://quote.eastmoney.com/center/list.html#28003684_0_2'
driver.get(url)
usoup = BeautifulSoup(driver.page_source, 'xml')
n=[]
while True:
     t=usoup.find('table',{'id':'fixed'})
     utable=t.find_all('a',{'target':'_blank'})
     for i in range(len(utable)):
          if i % 6 ==1:
             n.append(utable[i].text)
          if #停止條件怎么寫:
            break
     driver.find_element_by_xpath(r'//*@id="pagenav"]/a[2]').click()
     usoup = BeautifulSoup(driver.page_source, 'xml')

后面這里就不會(huì)寫了。。。

大家講道理
大家講道理

光陰似箭催人老,日月如移越少年。

reply all(4)
巴扎黑

You can judge the entries on each page. There are 20 entries on each page. If the current page has less than 20 entries, it means that this page is the last page. You should stop after crawling the current page

洪濤

By the way, doesn’t this form have a jsonp return interface? Why still climb?

PHPzhong

It uses the jsonp interface, just take it.

If you have to crawl it, you can only use a simulation page like selenium + phantomjs to get it.

伊謝爾倫

http://nufm.dfcfw.com/EM_Fina...{rank:[(x)],pages:(pc)}&token=7bc05d0d4c3c22ef9fca8c2a912d779c&jsName=quote_123&_g=0.5385195357178545

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template