爬取当当电子书排名
from selenium import webdriverimport time
from bs4 import BeautifulSoup
import re
from openpyxl import Workbook
browser = webdriver.Firefox(executable_path="C:\\Program Files\\Mozilla Firefox\\geckodriver.exe")
# 保存到表格
wb = Workbook()
ws = wb.active
ws.title = "Sheet1"
Project = [
'排名','书名','作者','价格','内容介绍'
]
for i in range(len(Project)):
ws.cell(1, i + 1, Project)
url = 'http://e.dangdang.com/rank_detail_page.html?listType=ddds_sale&channelType=all'
browser.get (url)
time.sleep(3)
browser.find_element_by_xpath('//div').click()
**** Hidden Message *****
页:
[1]