python+selenium根据搜索词在亚马逊上找到符合条件的ASIN
使用前提是安装selenium库,webdriver的下载地址可参考https://blog.csdn.net/shijunjoy/article/details/88719408
from selenium import webdriver
import time,xlwings
def read_by_excel(file):
#从excel中读取数据
app = xlwings.App()
wb = app.books.open(file)
ws = wb.sheets('汇总')
search_words = ws.range('g2:g33').value
app.quit()
return search_words
def write_asins(file,asins:list):
#将找到的asin存放到文档文件中
with open(file,'a') as f:
for asin in asins:
f.write('\n' + asin)
def Amazon_English(browser):
#将亚马逊的语言设置为英文
browser.get(