python带你采集不可言说网站数据,并带你多重骚操作~

Python+Selenium实现短视频自动上传与发布 前言 最近有人对自动上传与发布很感兴趣,都私下找我说了好几次了。今天,必须把他安排,必须实力宠粉。 “本篇依次介绍目前主流的短视频平台(抖音、快手、B站、小红书、微视、百度好看视频、西瓜视频、微信视频号、搜狐视 频、一点号、大风号、趣头条等)的短视频自动发布,希望帮助大家更方便、高效的来进行自媒体的创作与管理。 Python+selenium 自动化 - 趣头条的短视频自动上传与发布 第一章:效果展示 ① 效果展示 ② 素材展示 一个为视频,另一个为像素大小不小于视频的封面。 第二章:实现过程 ① 阅读详情

前言

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

今天我们采集国内知名的shipin弹幕网站!

这里有及时的动漫新番,活跃的ACG氛围,有创意的Up主。

大家可以在这里找到许多欢乐。

image.png

python方向

  • 爬虫程序 >>> 爬虫工程师 采集数据处理
  • 网站开发 >>> 开发工程师
  • 数据分析 >>> 数据分析师 处理表格 word
  • 自动化
  • 游戏开发/辅助
  • 人工智能/机器学习 深度学习
  • 自动化测试 运维

环境使用:

  • Python 3.8
  • Pycharm 2021.2版本
  • ffmpeg

<需要设置环境变量> 软件的使用 合成视频和音频 需要私我领取

模块使用:

需要安装模块

  • import requests >>> pip install requests

内置模块 你安装好python环境就可以了

  • import re
  • import json
  • import subprocess

秘籍 <适用于任何网站, 采集任何数据>

一. 数据来源分析

  1. 确定自己需求 <采集网站是那个, 获取数据是什么东西>
  2. 通过开发者工具进行抓包分析, 分析我们想要数据内容来自于哪里 <通过网页源代码就可以找到相应数据内容>
    shipin信息数据 在网页源代码里面 playinfo里面
    shipin标题

我们想要数据内容都是来自于网页源代码

I. 用浏览器打开这个所采集的网址

II. 在这个网页上面用鼠标右键点击查看网页源代码 会弹出一个新的窗口

III. ctrl + F 打开搜索框 搜索playinfo 可以找到相关信息数据

IV. ctrl + F 打开搜索框 搜索shipin标题, 也可以找到相关的数据内容

二. 代码实现步骤过程 基本四大步骤

  1. 发送请求, 模拟浏览器对于url网址发送请求 <专门定义函数来发送请求>
  2. 获取数据, 获取网页源代码
  3. 解析数据, 提取我们想要数据内容 <shipin信息以及shipin标题>
  4. 保存数据, 把shipin内容保存本地

代码

1. 导入所需模块

不是内置模块的小可耐们记得安装哦~

import requests  # 数据请求模块 <发送请求工具>
import re  # 正则表达式
import json  # 序列化与反序列
import pprint  # 格式化输出模块
import subprocess
import os

因审核机制原因,我把网址里的一些东西删掉了,小可耐们可以自己添加一下哈,很容易的

还有两个字,我用拼音代替了,你们可以改回文字哦 ~

如果有不太会改或者有点点小懒惰的小可耐也可以私信我,我发你呐~ 💖

(或查看并点击网页主页(文章)左侧的流动文字免费获取哦~(可能需要往下划一下呐))

2. 模拟浏览器发送请求

def get_response(html_url, data=None):
    """
    发送请求函数
    def 关键字 用于自定义函数 get_response 自定义函数名字
    :param html_url:  形式参数<不具备实际意义> 传入到这个函数参数  发送请求网址
    :return: 响应对象

    模拟浏览器发送请求
        headers 请求头进行伪装模拟 user-agent 用户代理意思 表示浏览器基本身份标识
    <Response [200]>   <>在python里面表示对象 响应对象 200 状态码 表示请求成功

    相当于打电话, 打通了嘟嘟嘟声音
    404 网址不对      相当于你所拨打电话是空号
    503 服务器有问题   相当于你所拨打电话不在服务区
    403 你没有访问权限  相当于你所拨打电话正在通话中
    """
    headers = {
   
   
        'referer': 'https://www..com/',  # 防盗链 告诉服务器你请求url是从哪里跳转过来的
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
    }
    response = requests.get(url=html_url, params=data, headers=headers)
    return response

3. 获取数据

def get_video_info(play_url):
    """
    获取shipin信息函数
    :param play_url: shipin播放详情页
    :return: 信息shipin信息
    仰望星空脚踏实地
    不会用正则 6 通过相关语法,可以对于字符串数据提取自己想要内容 解析数据
    re.findall() 通过re模块里面findall 去找到所有我们想要数据内容
        从什么地方去找什么样数据内容  从response.text里面去找 "title":"(.*?)","pubdate" 中(.*?) 这段是我们想要数据
        '"title":"(.*?)","pubdate"', response.text
    保存数据, 标题作为文件名保存, 以字符串数据形式 列表取值
    len 统计元素个数 [0] 根据索引位置取值 列表索引位置从0开始计数
    type() 内置函数,查看数据类型
    """
    # 定义了函数, 一定要调用
    response = get_response(html_url=play_url)  # 调用前面定义好的发送请求函数 函数是可以重复调用
    # print(response.text)  # response.text 获取响应对象文本数据 <获取网页源代码>  字符串数据
    title = re
Python爬虫采集抓取:Python3.x+Fiddler 采集抓取 APP 数据 随着移动互联网的市场份额逐步扩大,手机 APP 已经占据我们的生活,以往的数据分析都借助于爬虫采集爬取网页数据进行分析,但是新兴的产品有的只有 APP,并没有网页端这对于想要提取数据的我们就遇到了些问题,本章以豆果美食 APP 为例给大家演示如何利用Python爬虫采集抓取提取手机APP数据。具体教程如下: 一、安装 Fiddler Fiddler 官网下载地址:http://www.... 阅读详情

相关推荐

使用C# CefSharp Python采集某网站简历并且自动发送邀请短信的方法

主要给大家介绍了关于如何使用C# CefSharp Python采集某网站简历并且自动发送邀请短信的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面来一起看看吧

Datawhale~数据挖掘实践之序列问题处理~天池·资金流入流出预测-挑战Baseline~Day01~数据探索与分析

写在前面✍ 本系列笔记基于天池平台上“资金流入流出预测-挑战Baseline”学习赛,记录如何完整的打一次数据挖掘类比赛。同时,该比赛属于序列建模问题,希望学习完成这个任务,可以对序列问题的处理有一定的独立思考能力和实践操作能力,可以将所学理论,用编码的形式和实际的问题得到深入。 第一篇,EDA Content: 初步了解赛题及数据 1.1 任务 1.2 用户基本信息数据 1.3 用户申购赎回数据 1.4 收益率表 1.5 银行间拆借利率表 1.6 提交格式 1.7 评分指标 EDA 1 初.

小卜妞的博客 2368

Claude Code 接入 DeepSeek-V4 教程

本文介绍Claude Code的安装配置流程:1) 安装Node.js 18+和Git(Windows);2) 通过npm全局安装@anthropic-ai/claude-code;3) 配置DeepSeek API环境变量(需替换API Key);4) 启动Claude Code或配置VSCode插件。重点包括Linux/macOS和Windows的环境变量设置方法,以及VSCode插件的settings.json配置项。完成配置后即可在终端或VSCode中使用Claude Code功能。

培根芝士的专栏 2035

蜗牛星际+OpenWrt实战:双网口变AP模式,让所有设备同网段互通

本文详细介绍了如何将蜗牛星际双网口小主机刷入OpenWrt系统,并将其配置为AP模式,实现与主路由同网段的无缝桥接。通过关闭DHCP、桥接物理网口等核心步骤,解决家庭网络设备割裂问题,让所有设备在同一局域网内高效互通,特别适合追求网络简洁和厌恶多级NAT的技术爱好者。

zero1的博客 972

伪距单点定位推导+DOP值分析(附matlab仿真代码)

伪距单点定位公式推导、DOP值分析与matlab仿真分析

shannanshouyin的博客 2519

使用openclaw出现blocked URL fetch (url-fetch) reason=Blocked: resolves to private/internal/special 解决方案

本文主要介绍了使用openclaw出现blocked URL fetch (url-fetch) target=https://news.google.com/search reason=Blocked: resolves to private/internal/special-use IP address 解决方案,希望能对使用xx的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 12万+

Happycapy深度解析:AI智能体的“iPhone时刻“来了?

从理论到实践深度解析了融合OpenClaw和ClaudeCode优点的超强智能体工具Happycapy

program哲学 464

【VTKExamples::PolyData】第十六期 GradientFilter

本文分享VTK样例GradientFilter,并解析接口vtkGradientFilter & vtkAssignAttribute,希望对各位小伙伴有所帮助!

qq_40041064的博客 325

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

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

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.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")

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

上一篇: 【python游戏制作】僵尸来袭 ~ 快来一起创造植物叭~
下一篇: 用python对美女内容采集,舞蹈区内容真热闹~
魔王不会哭
博客等级 码龄5年 6003粉丝 394原创
评论 6
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址