Python获取某平台直播间封面, 实现颜值检测, 进行排名

Python爬取高颜值美女(爬虫+人脸检测+颜值检测) 1 数据源 知乎话题『美女』下所有问题中回答所出现的图片 2 抓取工具 Python 3,并使用第三方库 Requests、lxml、AipFace,代码共 100 + 行 3 必要环境 Mac / Linux / Windows (Linux 没测过,理论上可以。Windows 之前较多反应出现异常,后查是 windows 对本地文件名中的字符做了限制,已使用正则过滤) 无需登录知乎... 阅读详情

前言

嗨喽,大家好,这里是魔王~


[课程内容]:

Python获取某平台直播间封面, 实现颜值检测, 进行排名


[开发环境]:

  • Python 3.8
  • Pycharm 2021.2
  • 会使用API接口 百度云接口

[模块使用]:

  • requests
    安装命令: pip install requests
  • tqdm
    安装命令: pip install tqdm
  • os
  • base64

相对应的安装包/安装教程/激活码/使用教程/学习资料/工具插件 可以找我领取


模块安装问题:

- 如果安装python第三方模块:
    1. win + R 输入 cmd 点击确定, 输入安装命令 pip install 模块名 (pip install requests) 回车
    2. 在pycharm中点击Terminal(终端) 输入安装命令
- 安装失败原因:
    - 失败一: pip 不是内部命令
        解决方法: 设置环境变量

    - 失败二: 出现大量报红 (read time out)
        解决方法: 因为是网络链接超时,  需要切换镜像源
            清华:https://pypi.tuna.tsinghua.edu.cn/simple
            阿里云:http://mirrors.aliyun.com/pypi/simple/
            中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
            华中理工大学:http://pypi.hustunique.com/
            山东理工大学:http://pypi.sdutlinux.org/
            豆瓣:http://pypi.douban.com/simple/
            例如:pip3 install -i https://pypi.doubanio.com/simple/ 模块名

    - 失败三: cmd里面显示已经安装过了, 或者安装成功了, 但是在pycharm里面还是无法导入
        解决方法: 可能安装了多个python版本 (anaconda 或者 python 安装一个即可) 卸载一个就好
                或者你pycharm里面python解释器没有设置好

如何配置pycharm里面的python解释器?

1. 选择file(文件) >>> setting(设置) >>> Project(项目) >>> python interpreter(python解释器)
2. 点击齿轮, 选择add
3. 添加python安装路径

pycharm如何安装插件?

1. 选择file(文件) >>> setting(设置) >>> Plugins(插件)
2. 点击 Marketplace  输入想要安装的插件名字 比如:翻译插件 输入 translation / 汉化插件 输入 Chinese
3. 选择相应的插件点击 install(安装) 即可
4. 安装成功之后 是会弹出 重启pycharm的选项 点击确定, 重启即可生效

本案例分为两个阶段

第一个阶段 去采集主播照片数据

爬虫基本流程:

一. 数据来源分析
主播照片, 照片url地址 可以从哪里获取 >>> 通过网页上面开发者工具进行抓包分析
二. 代码实现步骤 发送请求 >>> 获取数据 >>> 解析数据 >>> 保存数据
1. 发送请求, 对于 https://www.huya.com/g/2168 发送请求 列表页面
2. 获取数据, 获取服务器返回的响应数据 response
3. 解析数据, 提取我们想要数据内容 主播名字 主播封面图url地址
    json数据 可以直接处理
    re正则表达式提取
    根据标签节点/属性提取内容:
        xpath
        css选择器
4. 保存数据, 图片内容保存到本地文件夹

第二阶段 颜值检测

对于我们保存下来照片, 进行颜值检测评分

导入模块

# 导入数据请求
import requests  # pip install requests (导入模块没有使用是灰色)
# 导入格式化输出模块
import pprint
# 导入os文件操作模块
import os
import base64
from tqdm import tqdm

第一步,采集照片

# 发送请求
# 确定请求的url地址
for page in range(1, 11):
    url = f'https://www.huya.com/cache.php?m=LiveList&do=getLiveListByPage&gameId=2168&tagAll=0&page={page}'
    # headers 请求头 伪装Python的代码 不被识别出来是爬虫程序...
    # headers 是一个字典数据类型
    headers = {
   
   
        'user-agent': 'Mozilla/5.0 (Win
Python爬虫 + 人脸检测 + 颜值检测 = 知乎高颜值图片抓取 声明:文中所有文字、图片以及相关外链中直接或间接、明示或暗示涉及性别、颜值分数等信息全部由相关人脸检测接口给出。无任何客观性,仅供参考。1 数据源知乎话题『美女』下所有问题中回答所出现的图片2 抓取工具Python 3,并使用第三方库 Requests、lxml、AipFace,代码共 100 + 行3 必要环境Mac / Linux / Windows (Linux 没测过,理论上可以。Wind... 阅读详情

相关推荐

【信息科学与工程学】【广告科学】第四十四篇 广告平台投放和广告计费类算法01

全行业的中国企业广告投放模型总表。行业分类依据《国民经济行业分类》(GB/T 4754—2017)的门类/大类 ,产品层参考"主营产品统计代码"行业—产品映射 ,平台算法以巨量引擎、腾讯广告等官方文档为硬支撑 ,合规部分严格对齐《互联网广告管理办法》以及2026年市场监管部门最新合规提示 。编号类型(门类)行业(大类)企业及产品内容列表投放模型投放平台投放人群欲望激发维度面向人群模式(地域/文化/年龄/角色)001A 农林牧渔01 农业北大荒/中粮:五常大米、面粉、食用油、杂粮品牌曝光 + 电商转化双轨(C

weixin_49199313的博客 1662

基于python的人脸检测

通过打开摄像头进行拍照,获取图,然后进行人脸的检测

如何解决ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.

解决ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE

2744

Deepseek+Word插件:一键搞定论文翻译与润色的学术写作新革命

本文介绍了Deepseek Word插件如何革新学术写作流程,实现论文翻译与润色的一键操作。该插件深度集成于Word环境,能智能完成中英互译、语法修正、术语统一及逻辑优化,显著提升写作效率与文本质量,是研究者的高效AI助手。

weixin_29252171的博客 513

嵌入式系统存储体系

主要分为三种:高速缓存(cache)、主存和外存。

weixin_43586667的博客 2266

拉曼光谱入门:10.显微拉曼与共聚焦技术

本文系统阐述了显微拉曼光谱技术与共聚焦原理的融合机制,详细解析了从激光激发、针孔空间滤波到光谱采集的完整光路架构,阐明了共聚焦设计在提升三维空间分辨率、抑制荧光背景及实现微区无损层析方面的核心优势,并探讨了关键光学器件的性能边界与系统技术局限。

qq_53529450的博客 168

lammps蒙特卡洛MC模拟案例

在lammps中,和MC相关的模拟命令有三个:fix gcmc、fix atom/swap、fix sgcmc。在一个lammps模拟中,mc和md可同时存在,间隔运行,所以设置fix sgcmc命令的同时,可以同时设置系综(nve、nvt或者npt)。lammps官网自带案例中也有一个fix sgcmc的案例,主要模拟FeCu合金的MC建模。sgcmc命令可应用到合金的模拟中,如短程有序模拟。MC运行间隔为100步,最终的浓度比例为0.02,也就是2%的Fe原子交换为Cu原子。大家好,我是小马老师。

lammps_jiayou的博客 1827

一篇把 Transport 做到可复制的实战指南:从 CTS 底层表到 LSMW、Variant、Layout、TABU、Query、SAPscript 全对象搬运

本文深入解析SAP系统中的Transport机制,将其视为可审计、可追溯的变更流水线。文章从CTS/Transport Organizer通用方法论和具体对象搬运手法两个层面展开,详细介绍了LSMW项目、程序Variant、屏幕/ALV Layout、表数据、ABAP Query、SAPscript和SO10标准文本等对象的传输策略。通过真实案例说明,代码对象往往能被正确传输,但"运行体验"和"业务配置"却常被遗漏,导致QAS测试正常而PRD环境异常。文章提供了一套可

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 178

Open3D(C++) 点云构建三维Delaunay三角剖分

C++版本的Open3D实现从点云构建三维Delaunay,可视化效果。

点云侠的博客 2247

统计学习导论(ISLR) 第四章分类算法课后习题

统计学习导论(ISLR) 参考资料: The Elements of Statistical Learning An Introduction to Statistical Learning 统计学习导论(ISLR)(二):统计学习概述 统计学习导论(ISLR)(三):线性回归 统计学习导论(ISLR)(四):分类 ISLR统计学习导论之R语言应用(二):R语言基础 ISLR统计学习导论之R语言应用(三):线性回归R语言代码实战 ISLR统计学习导论之R语言应用(四):分类算法R语言代码实战 统计学习导论

阿里云专家博主、数据科学领域优质创作者、统计er在读 2万+

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

深度学习工具包 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")

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

上一篇: 用Python教你批量下载某筷视频,防止作者视频突然消失
下一篇: 学生问我25-30K得面试题能不能帮忙,这我不得上,爬取某网站电影视频内容
魔王不会哭
博客等级 码龄5年 6003粉丝 394原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值