資源簡(jiǎn)介
python 爬蟲爬取京東代碼
代碼片段和文件信息
from?selenium?import?webdriver
from?lxml?import?etree
import?requestsos
import?re
import?time
from?easygui?import?enterboxmsgboxynbox
headers={‘UserAgent‘:‘Mozila/5.0‘}
driver=webdriver.Chrome(‘C:/Users/Administrator/AppData/Local/Programs/Python/Python37-32/scripts/chromedriver.exe‘)
sku_ji=0
while?1:
????sku_ji+=1
????s=enterbox(msg=‘請(qǐng)輸入網(wǎng)址:‘)
????driver.get(s)
????sku=‘‘
????#?s=input(‘11111111111111‘)
????#?with?open(‘C:/Users/Administrator/Desktop/jd.txt‘‘w‘encoding=‘utf-8‘)as?a:
????#?????????????a.write(driver.page_source)
????def?alll(ssku):
????????ji_xiatu=1
????????driver.execute_script(‘window.scrollTo(03000)‘)
????????time.sleep(1)
????????driver.execute_script(‘window.scrollTo(06000)‘)
????????time.sleep(1)
????????driver.execute_script(‘window
評(píng)論
共有 條評(píng)論