提交 a87847a0 编写于 作者: 梦想橡皮擦's avatar 梦想橡皮擦 💬

文件案例

上级 5d868953
无相关合并请求
......@@ -15,9 +15,10 @@ db.init_app(app) # 初始化数据库
from app import routes
from app import general
from .school.index import *
from .file.index import *
app.register_blueprint(s)
app.register_blueprint(f)
......
无法预览此类型文件
文件已添加
文件已添加
from flask import Blueprint, request
from flask import render_template
f = Blueprint('file', __name__, url_prefix='/file')
@f.route('/c')
def common_file():
return render_template('file/c.html')
@f.route('/mp4')
def mp4_file():
mp4_url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
return render_template('file/mp4.html', file=mp4_url)
@f.route('/m3u8')
def m3u8_file():
return render_template('file/m3u8.html')
<!DOCTYPE html>
<html>
{%include 'common/header.html' %}
{% block head %}
<head>
{% include 'common/header.html'%}
{% block link %}{% endblock link %}
{% block script %}{% endblock script %}
{% include 'common/tj.html'%}
</head>
{% endblock %}
<body>
{%block content%}{%endblock content%}
{% include 'common/nav.html'%}
{% block content %} {% endblock content %}
{% include 'common/footer.html' %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
\ No newline at end of file
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if title%}
<title>{{title}}|爬虫训练场,让天下没有失效的爬虫</title>
{% else %}
<title>爬虫训练场,让天下没有失效的爬虫</title>
{%endif%}
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{{url_for('static',filename='css/base.css')}}">
{% include 'common/tj.html'%}
</head>
\ No newline at end of file
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if title%}
<title>{{title}}|爬虫训练场,让天下没有失效的爬虫</title>
{% else %}
<title>爬虫训练场,让天下没有失效的爬虫</title>
{%endif%}
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{{url_for('static',filename='css/base.css')}}">
\ No newline at end of file
{% extends "base.html" %}
{%block link%}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
{%endblock link%}
{% block content %}
<div class="container text-center mt-3" style="min-height:600px;">
<h3>爬虫采集文件练习</h3>
<div class="d-grid mt-2">
<a class="btn btn-primary"
href="https://maths.whu.edu.cn/__local/1/12/4A/86AB997BEBDB836B166DC23CDAB_47C87642_1F200.doc"
download="file.doc"><i class="bi bi-file-word"></i> WORD 文档:点击下载文件</a>
<a class="btn btn-success mt-2"
href="https://www.pipechina.com.cn/img/web/f756436145e73afced434d0838191374.xls"
download="file.xls"><i class="bi bi-file-earmark-excel"></i> Excel 文档:点击下载文件</a>
<a class="btn btn-warning mt-2"
href="https://ndac.env.tsinghua.edu.cn/app/data/6.1poster_16th.pptx"
download="file.ppt"><i class="bi bi-file-ppt"></i> PPT 文档:点击下载文件</a>
<a class="btn btn-danger mt-2"
href="https://admission.ucas.ac.cn/Content/Upload/2021/6/%E5%9C%B0%E7%90%86%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F.pdf"
download="file.pdf"><i class="bi bi-file-earmark-pdf"></i> PDF 文档:点击下载文件</a>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{%block script%}
<script src="https://www.helloweba.net/demo/2018/hls/hls.js"></script>
{%endblock script%}
{% block content %}
<div class="container text-center">
<video id="video" controls loop="false" width="100%"></video>
</div>
<script type="text/javascript">
var video = document.getElementById('video');
if(Hls.isSupported()) {
var hls = new Hls();
hls.loadSource('http://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8');
hls.attachMedia(video);
}
</script>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block content %}
<div class="container text-center mt-3">
<div class="row">
<div class="col-12">
<div class="embed-responsive embed-responsive-16by9">
<video class="embed-responsive-item" src="{{file}}" controls></video>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block content %}
{% include 'common/nav.html'%}
<div class="container pt-5">
<h3 class="text-success">普通爬虫</h3>
......@@ -29,10 +28,12 @@
</div>
</div>
<div class="col mt-2">
<div class="card border-info rounded-5 shadow-sm" style="min-height:268px;min-width:300px;">
<div class="card border-info rounded-5 shadow-sm" style="min-height:268px;min-width:300px;">
<div class="card-header text-center">
<h4 class="card-title">分页爬虫</h4>
<div class="bg-danger text-white rounded p-1" style="transform: rotate(20deg); position:absolute;right:0;top:0.5rem;">最新更新</div>
<div class="bg-danger text-white rounded p-1"
style="transform: rotate(20deg); position:absolute;right:0;top:0.5rem;">最新更新
</div>
</div>
<div class="card-body">
<p class="card-text">本案例是由 2760 条数据组成的分页爬虫,数据为国内学校清单,主要用于练习分页数据采集。</p>
......@@ -43,29 +44,30 @@
</p>
</div>
<div class="card-footer text-end">
<a href="#" class="btn btn-primary card-link ">学习博客</a>
<a href="#" class="btn btn-primary card-link ">学习博客</a>
</div>
</div>
</div>
<div class="col mt-2">
<div class="card border-secondary rounded-5 shadow-sm" style="min-height:268px;min-width:300px;">
<div class="card border-info rounded-5 shadow-sm" style="min-height:268px;min-width:300px;">
<div class="card-header text-center">
<h4 class="card-title">单页爬虫</h4>
<h4 class="card-title">二进制文件采集</h4>
<div class="bg-danger text-white rounded p-1"
style="transform: rotate(20deg); position:absolute;right:0;top:0.5rem;">最新更新
</div>
</div>
<div class="card-body">
<p class="card-text">目标数据呈现在单一页面中,使用最简单的爬虫库可以直接采集,一般用正则表达式即可完成数据提取</p>
<p class="card-text">本案例用于大家学习文件和视频文件内容采集,重点掌握 M3U8 格式视频下载,掌握二进制内容保存</p>
<p class="card-text text-left">难度:⭐</p>
<p class="card-text">
案例:
<a href="/general/news" class="card-link text-success">新闻页</a>
<a href="/general/imgs" class="card-link text-success">图片清单</a>
<a href="/general/table" class="card-link text-success">表格</a>
<a href="/file/c" class="card-link text-success">普通</a>
<a href="/file/mp4" class="card-link text-success">MP4文件</a>
<a href="/file/m3u8" class="card-link text-success">M3U8文件</a>
</p>
</div>
<div class="card-footer text-end">
<a href="#" class="btn btn-primary card-link ">学习博客</a>
</div>
</div>
</div>
......@@ -221,5 +223,4 @@
</div>
</div>
{% include 'common/footer.html'%}
{% endblock %}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部