教你用Python+PyQt5制作一款视频数据下载小工具!

实战|教你用Python+PyQt5制作一款带有界面的B站爬虫小程序 前言 大家好,我是J哥。 目前,市场上有大量 Python图形用户界面(GUI)开发框架可供选择,如wxpython 、pyqt5、Gtk、Tk等。本文将用Python结合PyQt5制作一款B站视频数据爬虫小程序,可以通过输入关键字、页码以及选择存储路径后,下载相应的数据,演示效果如下: 以下将详细介绍这个GUI工具的制作方法,如需本文完整代码,后台回复「GUI」。 开发环境 Python3 Pycharm PyQt5 Qt Designer requests 准备工作 首先,新建一个bilibili. 阅读详情

目前,市场上有大量 Python图形用户界面(GUI)开发框架可供选择,如wxpython 、pyqt5、Gtk、Tk等。本文将用Python结合PyQt5制作一款B站视频数据下载器,可以通过输入关键字、页码以及选择存储路径后,下载相应的数据,演示效果如下:

PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取

python免费学习资料以及群交流解答点击即可加入

开发环境

Python3
Pycharm
PyQt5
Qt Designer
requests

准备工作

首先,新建一个bilibili.py文件。获取B站视频数据的爬虫代码相对简单,只要设置好url的keyword和page参数,即可轻松获取数据。以下贴出完整代码:

# -*- coding = uft-8 -*-
# @Time : 2020-11-11
# @Author : 「菜J学Python」J哥

import requests
from lxml import etree
import time
import random
import csv

def get_target(keyword,page):
    for i in range(1,page + 1):
        headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'}
        url = 'https://search.bilibili.com/all?keyword={0}&from_source=nav_suggest_new0&page={1}'.format(keyword,page)
        html = requests.get(url.format(i),headers = headers)
        bs = etree.HTML(html.text)
            items = bs.xpath('//li[@class = "video-item matrix"]')
            for item in items:
                title = item.xpath('div[@class = "info"]/div/a/@title')[0]
                click = item.xpath('div[@class = "info"]/div[3]/span[1]/text()')[0].strip('\n        ').replace("万","")
                danmu = item.xpath('div[@class = "info"]/div[3]/span[2]/text()')[0].strip('\n        ')
                date = item.xpath('div[@class = "inf
Python 第三方库 PyQt5 的安装 在当今数字化的时代,高效、直观的图形用户界面(GUI)对于软件应用的开发至关重要。Python 作为一种功能强大、简洁易学的编程语言,拥有丰富的第三方库来扩展其功能。其中,PyQt5 便是一个非常出色的用于创建 GUI 应用的库。PyQt5 结合了 Python 的简洁性与 Qt 的强大功能,为开发者提供了一种便捷的方式来构建跨平台的桌面应用程序。无论是小型工具还是复杂的企业级软件,PyQt5 都能满足不同规模项目的需求。 阅读详情

相关推荐

从Transformer到蛋白质结构预测:手把手解读ESM系列模型的核心原理与实战价值

本文深入解析了ESM系列模型如何将Transformer架构创新应用于蛋白质结构预测,揭示了其从氨基酸序列到三维结构的高效预测机制。通过掩码语言模型预训练和注意力机制,ESM模型不仅捕捉蛋白质序列的远程相互作用,还在蛋白质工程改造、药物发现等领域展现出巨大实战价值,显著提升了结构预测速度和精度。

weixin_28744423的博客 318

[Windows] 发票识别工具。支持xml、pdf、ofd文件。

发票识别是财务自动化中的关键环节,支持多种格式(XML、PDF、OFD)的识别工具能显著提升工作效率。以下介绍基于Windows平台开发此类工具的技术方案。发票识别是财务自动化中的关键环节,支持多种格式(XML、PDF、OFD)的识别工具能显著提升工作效率。以下介绍基于Windows平台开发此类工具的技术方案。

pZC_dqux的博客 666

基于PyTorch的BP神经网络PID控制器动态调参实战

本文详细介绍了基于PyTorch的BP神经网络PID控制器动态调参实战,结合BP神经网络的自适应能力和PID控制算法的经典优势,实现工业控制中的高效参数调整。通过PyTorch实现BP-PID融合架构,包括网络设计、损失函数优化及动态调参技巧,显著提升控制性能,适用于温度控制、电机控制等场景。

weixin_29094775的博客 520

告别ArcGIS小红叉:从‘无法验证登录信息’到成功连接在线资源的完整排错记录

本文详细记录了从Windows便签的网络错误到ArcGIS连接问题的完整排错过程。通过分析代理服务器、DNS配置和系统网络设置,解决了ArcGIS无法验证登录信息的问题,提供了实用的网络优化方案和技术排错思路。

weixin_26800111的博客 389

YOLOv11损失函数原理与源码解读:从调参血泪史到源码级优化

本文深入解析YOLOv11目标检测模型的损失函数设计,揭示其相比前代的关键改进。重点剖析了回归损失中动态权重的小目标优化、分类损失的带温度系数softmax、以及目标损失的自适应阈值机制等创新点。作者通过源码分析指出常见实现陷阱,如梯度回传的正确处理方式、标签分配的匹配策略等。结合实战经验,给出针对小目标检测、类别误判等典型问题的调参建议,并分享实用的调试工具代码片段。最后强调损失函数调参需结合具体任务,指出后处理对实际部署效果的重要影响。全文以工程实践为导向,为开发者提供可直接落地的优化思路。

as1225120794的博客 440

Python地理数据处理 十七:植被物候提取和分析(Savitzky-Golay)

植被是陆地生态系统中最重要的组分之一,也是对气候变化最敏感的组分,其在全球变化过程中起着重要作用,能够指示自然环境中的大气、水、土壤等成分的变化,其年际和季节性变化可以作为地球气候变化的重要指标。此外,由于生态工程保护建设和植被自然生长等因素,中国陆地生态系统发挥了重要的碳汇作用。因此,定量评估植被时空动态变化是制定生态系统可持续发展目标和衡量生态系统固碳潜力的重要前提,卫星遥感数据衍生的生态参量产品为研究长时间序列全球及区域植被时空变化提供了重要数据源。SG滤波能够对物候信息进行平滑,并提取其中的物候信息

amyniez的博客,欢迎交流讨论 4246

基于 Verilog 的经典数字电路设计(10)三态门

三态门(Triple-State Gate)亦称 “三态输出门”、“三态门输出电路”,是一种重要的总线接口电路,具有高电平、低电平和高阻抗三种输出状态的门电路,不过我们通常在设计中比较少见。   三态指其输出既可以是一般二值逻辑电路,即正常的高电平(逻辑 1)或低电平(逻辑 0),又可以保持特有的高阻抗状态,高阻态相当于隔断状态(电阻很大,相当于开路)。

新芯设计的博客 1万+

3. Matérn协方差模型与随机偏微分方程

对应的高斯马尔可夫随机场 (GMRF)可以通过使用某种随机偏微分方程(SPDE)明确构造,当由高斯白噪声驱动时,随机偏微分方程的解是具有 Matérn 协方差函数的高斯场(GF)

weixin_40614311的博客 1745

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

上一篇: 实用小技巧,Python一秒将全部中文姓名转为拼音!
下一篇: 怎样用Python检测抄袭行为?广大中小学生们的美梦就此结束
pythonlaodi
博客等级 码龄6年 286粉丝 244原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值