项目演示
孔网爬取图书信息
目录结构
[' |-- api-ms-win-core-synch-l1-2-0.dll',' |-- api-ms-win-core-sysinfo-l1-1-0.dll',' |-- api-ms-win-core-timezone-l1-1-0.dll',' |-- api-ms-win-core-util-l1-1-0.dll',' |-- api-ms-win-crt-conio-l1-1-0.dll',' |-- api-ms-win-crt-convert-l1-1-0.dll',' |-- api-ms-win-crt-environment-l1-1-0.dll',' |-- api-ms-win-crt-filesystem-l1-1-0.dll',' |-- api-ms-win-crt-heap-l1-1-0.dll',' |-- api-ms-win-crt-locale-l1-1-0.dll',' |-- api-ms-win-crt-math-l1-1-0.dll',' |-- api-ms-win-crt-multibyte-l1-1-0.dll',' |-- api-ms-win-crt-process-l1-1-0.dll',' |-- api-ms-win-crt-runtime-l1-1-0.dll',' |-- api-ms-win-crt-stdio-l1-1-0.dll',' |-- api-ms-win-crt-string-l1-1-0.dll',' |-- api-ms-win-crt-time-l1-1-0.dll',' |-- api-ms-win-crt-utility-l1-1-0.dll',' |-- base_library.zip',' |-- libcrypto-1_1.dll',' |-- libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll',' |-- libssl-1_1.dll',' |-- pyexpat.pyd',' |-- python3.dll',' |-- python37.dll',' |-- select.pyd',' |-- tcl86t.dll',' |-- tk86t.dll',' |-- ucrtbase.dll',' |-- unicodedata.pyd',' |-- VCRUNTIME140.dll',' |-- VCRUNTIME140_1.dll',' |-- _bz2.pyd',' |-- _cffi_backend.cp37-win_amd64.pyd',' |-- _ctypes.pyd',' |-- _decimal.pyd',' |-- _elementtree.pyd',' |-- _hashlib.pyd',' |-- _lzma.pyd',' |-- _multiprocessing.pyd',' |-- _queue.pyd',' |-- _socket.pyd',' |-- _ssl.pyd',' |-- _tkinter.pyd',' |-- 孔夫子二手书采集.exe',' |-- certifi',' | |-- cacert.pem',' | |-- py.typed',' |-- charset_normalizer',' | |-- md.cp37-win_amd64.pyd',' | |-- md__mypyc.cp37-win_amd64.pyd',' |-- cryptography',' | |-- hazmat',' | |-- bindings',' | |-- _rust.pyd',' |-- cryptography-41.0.7.dist-info',' | |-- INSTALLER',' | |-- LICENSE',' | |-- LICENSE.APACHE',' | |-- LICENSE.BSD',' | |-- METADATA',' | |-- RECORD',' | |-- REQUESTED',' | |-- top_level.txt',' | |-- WHEEL',' |-- file',' | |-- output.xlsx',' |-- lxml',' | |-- builder.cp37-win_amd64.pyd',' | |-- etree.cp37-win_amd64.pyd',' | |-- objectify.cp37-win_amd64.pyd',' | |-- sax.cp37-win_amd64.pyd',' | |-- _elementpath.cp37-win_amd64.pyd',' | |-- html',' | | |-- clean.cp37-win_amd64.pyd',' | | |-- diff.cp37-win_amd64.pyd',' | |-- isoschematron',' | |-- resources',
]
概述
毕业前做的小玩意,今天发现居然还能继续使用,孔夫子二手书采集软件可以将您本地的ISBN全部批量查询书籍信息,并切割保存到本地文件。可查询出版社、出版时间、在售/已售数量、可查询前五本的书籍信息
支持多线程采集
支持质量筛选、价格排序
原数据预览图
处理后的数据预览图
部分核心逻辑
Vb工程图
新建绘制一个VB视图
导出UI代码
数据导入与读取
def Command4_Cmd(self):global daoru_state# 打开文件选择对话框file_path = filedialog.askopenfilename(filetypes=[('Excel Files', '*.xlsx')])if file_path:# 加载Excel文件wb = load_workbook(filename=file_path)# 处理Excel文件# ...# 保存Excel文件到本地路径wb.save('file/output.xlsx')daoru_state=1# 提示用户导入成功#获取行数# 加载Excel文件wb = load_workbook(filename='file/output.xlsx')# 获取Sheet1工作表ws = wb.active# 获取行数row_count = ws.max_rowself.Text3Var.set(row_count)
下拉框选择参数
self.style.configure('TLabel5.TLabel', anchor='w', font=('宋体', 9))
self.Label5 = Label(self.Frame4, text='价格:', style='TLabel5.TLabel')
self.Label5.place(relx=0.077, rely=0.234, relwidth=0.234, relheight=0.182)self.style.configure('TLabel6.TLabel', anchor='w', font=('宋体', 9))
self.Label6 = Label(self.Frame4, text='品相:', style='TLabel6.TLabel')
self.Label6.place(relx=0.077, rely=0.584, relwidth=0.196, relheight=0.182)self.Combo2List = ['默认', '价格从低到高', '价格从高到低']
self.Combo2Var = StringVar(value='默认')
self.Combo2 = Combobox(self.Frame4, text='默认', textvariable=self.Combo2Var,
values=self.Combo2List, font=('宋体', 9))
self.Combo2.place(relx=0.383, rely=0.234, relwidth=0.541, relheight=0.146)
设置线程
stop_threads = False # 全局变量,控制线程的停止
# 总行数
total_rows = ws.max_row
# 线程数
num_threads = int(self.Text4Var.get())
# 每个线程处理的行数
rows_per_thread = math.ceil(total_rows / num_threads)
# 创建线程
threads = []
for i in range(num_threads):
# random_number = random.randint(1, )
start_row = i * rows_per_thread + 1
end_row = min((i + 1) * rows_per_thread, total_rows)
t = threading.Thread(target=process_rows,args=(start_row, end_row, table, self, order, quality, int(requests_spped)))
threads.append(t)# 启动线程
for t in threads:
t.start()# 将全局变量设置为False,表示线程不再执行
global stop_threads
stop_threads = False
# # 等待所有线程结束
使用方法
下载软件
下载压缩包后,解压到桌面,双击软件打开
授权
输入授权码123456
,完成授权验证
导入文件
找到演示文件夹,里面有预置数据,你可以根据格式替换成自己的
等待数据处理完成
预览处理后的数据
中间可以随时点击停止
打开文件夹
最后
如果你有定制需求请私信联系我,下载附件前请查看演示视频