Home > other >  Crawl taobao's problems
Crawl taobao's problems

Time:09-27

The import time
The from the selenium import webdriver
Brower=webdriver. Chrome ()
Brower. Set_page_load_timeout (30)
Brower. Get (' https://s.taobao.com/search? SPM=a230r. 1.0.0.79586 e9e6BUlIl & amp; Q=% % E5 8 d B8 E4 8 e % % % % BAP20 & amp; E5 spu_title=% % 8 d B8 E4 8 e % % % % BA + P20 & amp; App=detailproduct& Pspuid=1591360 & amp; Jc=1 & amp; The cat=1512 & amp; From_pos=19 _1512. Bpvcombo_1_0_1591360 ')
Time. Sleep (1)
# brower. Execute_script (" window. ScrollBy (0240) ")
Page_infor=brower. Find_element_by_css_selector (' # spudetail - pager & gt; Div & gt; Div & gt; Div & gt; Div. Total ')
# print (page_infor. Text)
Pages=page_infor. Text. The split () [1]
Brower. Execute_script (' window. ScrollTo (0, document. Body. ScrollHeight); ')

Time. Sleep (8)
Goodsshop=brower. Find_elements_by_class_name (' shopname)
For goodshop goodsshop in:
Print (goodshop. Text)
Results are not all crawl results, should how to change the program, that is to say, how to let all the shop name, according to new people for help
Three international digital official flagship store
Constant wave official flagship store
Synchronous feiyang digital stores
Huawei zhongtai store
You ask a digital official flagship store
Huawei's q store
China mobile official flagship store
Can a good digital official flagship store
Green, a digital official flagship store
Cheng330029
JianYi communication
Beauty artifact digital

CodePudding user response:

Sleep time is too short,

CodePudding user response:

Not, because taobao is asynchronous page loading so cannot turn pages directly to the bottom, part to part of the page

CodePudding user response:

refer to the second floor MG1723054 response:
no, because taobao page is asynchronous loading so I can't flip directly to the bottom, part to part of the page

Then use webdriver to control

CodePudding user response:

reference oyljerry reply: 3/f
Quote: refer to the second floor MG1723054 response:

No, it's because taobao page is asynchronous loading so I can't flip directly to the bottom, part to part of the page

Then use webdriver to control

Right, finally solved, using selenium to simulate mouse scroll

CodePudding user response:

You don't have to log in, climb the taobao to login now, how to solve ah

CodePudding user response:

refer to fifth floor Zhang Mo han Yang Paul - water without a month's reply:
you don't have to log in, climb the taobao to login now, how to solve ah

Is ah taobao to login
  • Related